- Sep 22, 2013
- 1,209
- 1,670
Code:
import os
from os import listdir,glob
from os.path import isfile, join
imageUrl = "recaptcha/api/v2....."
imageText = "a fire hydrant"
if imageText in [x[0] for x in os.walk(DIR)]:
folder_path = f"/User/redacted/desktop/images/{entry.name}"
counter = len(glob.glob(os.path.join(folder_path, '*.txt')))
r = requests.get(imageUrl, stream=True)
if r.status_code == 200:
with open(f"{folder_path}/{counter=+1}", 'wb') as f:
for chunk in r:
f.write(chunk)
Let's say the value of the imageUrl variable is a Recaptcha image url.
and the raw image from the URL looks like this :
Does running the script save only the fire hydrants from the image or the whole image(raw image)?
P.s. The code is not mine but from another experienced programmer who have no time.