Answer the question
In order to leave comments, you need to log in
How to solve the problem with loading captcha?
You need to upload the captcha image to the rucaptcha service and get the captcha text itself. The documentation for uploading images says:
Пример загрузки в формате multipart:
<form method="post" action="http://rucaptcha.com/in.php" enctype="multipart/form-data">
<input type="hidden" name="method" value="post">
Ключ от учетной записи:
<input type="text" name="key" value="YOUR_APIKEY">
Файл капчи:
<input type="file" name="file">
<input type="submit" value="загрузить и получить ID">
</form>
# POST a Multipart-Encoded File
url = 'http://httpbin.org/post'
files = {'file': open('report.xls', 'rb')}
r = requests.post(url, files=files)
key = 'mykey'
file = {'file': open('captcha.jpg', mode='rb')} # captcha.jpg - изображение с капчей
r = requests.post('http://rucaptcha.com/in.php', files=file, data={'key': key}) # OK|captchaid
id = r.text.split('|')[1]
inspect = 'CAPCHA_NOT_READY'
while inspect == 'CAPCHA_NOT_READY':
r2 = requests.get('http://rucaptcha.com/res.php?key='+key+'&action=get&id='+id)
inspect = r2.text
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question