From 7ec5644134679fba6f6fe7da1ef244a7c9372ad8 Mon Sep 17 00:00:00 2001 From: Matt Weller Date: Fri, 21 Nov 2025 10:05:12 +0000 Subject: [PATCH] add image uploading example (broken) and bathc file (working) --- request.bat | 4 ++++ request.py | 19 +++++++++++++++++++ request.sh | 5 +++-- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 request.bat diff --git a/request.bat b/request.bat new file mode 100644 index 0000000..5fe179d --- /dev/null +++ b/request.bat @@ -0,0 +1,4 @@ +:: you can use this like so from cmd or pwsh: +:: request.bat +@echo off +curl --header 'Additional: Header' --form additional=image --form image=@%1 https://u.aql.ink/new_image \ No newline at end of file diff --git a/request.py b/request.py index 1f27024..c761d4c 100644 --- a/request.py +++ b/request.py @@ -2,8 +2,27 @@ import requests + +# post to the url shortener url = "http://localhost:8192/new" payload = "http://some.long.domain.tld/directory/structure" r = requests.post(url, data=payload) print(r.text) + +# and to the image hosting service - this doesn't work for some reason :( + +url = "http://localhost:8192/new_image" +headers = { + 'Additional': 'Header', +} +files = { + 'additional': 'image', + 'image': open('random-pictures-MR0G79.jpg', 'rb'), +} +#payload = open(sys.argv[1], "rb") + +#print(files) + +r = requests.post(url, headers=headers, files=files) +print(r.text) diff --git a/request.sh b/request.sh index 5e05427..b9e8874 100644 --- a/request.sh +++ b/request.sh @@ -4,5 +4,6 @@ curl -v -d "https://some.long.tld/subdirectory/here" -X POST http://localhost:8193/new # testing image rehosting curl --header 'Additional: Header' --form additional=image --form image=@random-pictures-MR0G79.jpg http://localhost:8193/new_image -# get one of your uploading images -http://localhost:8193/i/ +#curl --header 'Additional: Header' --form additional=image --form image=@random-pictures-MR0G79.jpg https://u.aql.ink/new_image +# get one of your uploaded images +#http://localhost:8193/i/