Улучшение вывода при возврате ошибки от Яндекса
This commit is contained in:
parent
896f35327e
commit
7ba28fd5c3
1 changed files with 7 additions and 0 deletions
7
main.py
7
main.py
|
|
@ -432,6 +432,13 @@ if __name__ == '__main__':
|
||||||
if any(h in resp.headers['Content-Type']
|
if any(h in resp.headers['Content-Type']
|
||||||
for h in target_headers):
|
for h in target_headers):
|
||||||
logger.debug(resp.text)
|
logger.debug(resp.text)
|
||||||
|
if not resp.ok:
|
||||||
|
print('Яндекс вернул ошибку. Скорее всего, это связано с'
|
||||||
|
' с ограничением количества запросов.'
|
||||||
|
' Попробуйте перезапустить скрипт через некоторое время.'
|
||||||
|
' Если проблема сохраняется - откройте issue на github.')
|
||||||
|
print(f'Код ошибки: {resp.status_code}')
|
||||||
|
sys.exit(3)
|
||||||
if not getattr(resp, 'from_cache', False):
|
if not getattr(resp, 'from_cache', False):
|
||||||
time.sleep(args.delay)
|
time.sleep(args.delay)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue