Answer the question
In order to leave comments, you need to log in
How to call completion for from another function?
There is a grab() function that looks something like this:
def grab():
"""Сбор информации о хешах"""
for link in links:
url = link.get('href', '-')
image_url = link.find('img').get('src', '-')
print(url, image_url)
#Скачаем картинку
filename = 'temp.png'
r = requests.get(image_url, headers=headers)
if r.status_code == 200:
print('ok')
with open(filename, 'wb') as f:
f.write(r.content)
for mi in range(10):
if True:
compare(mi,image_url,url)
else:
break
def compare(mi,image_url,url):
"""Сравнивает картинки, принимает индекс mi"""
if np.allclose(img, img2):
print("Подходит!")
global hashes
hashes[mi] = image_url
else:
print("Дальше!")
#time.sleep(0.2)
for mi in range(10)
Answer the question
In order to leave comments, you need to log in
Interesting design
if True:
compare(mi,image_url,url)
else:
break
def grab():
"""Сбор информации о хешах"""
for link in links:
url = link.get('href', '-')
image_url = link.find('img').get('src', '-')
print(url, image_url)
#Скачаем картинку
filename = 'temp.png'
r = requests.get(image_url, headers=headers)
if r.status_code == 200:
print('ok')
with open(filename, 'wb') as f:
f.write(r.content)
success = False
for mi in range(10):
success = compare(mi,image_url,url)
if success:
break
def compare(mi,image_url,url):
"""Сравнивает картинки, принимает индекс mi"""
if np.allclose(img, img2):
print("Подходит!")
global hashes
hashes[mi] = image_url
return True
else:
print("Дальше!")
#time.sleep(0.2)
return False
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question