mirror of
https://github.com/sprockets/sprockets.mixins.http.git
synced 2024-11-15 03:00:29 +00:00
Extract the netloc when rate limited for more helpful log lines
This commit is contained in:
parent
77b5b95efa
commit
58a2a547d5
1 changed files with 5 additions and 2 deletions
|
@ -11,12 +11,13 @@ import logging
|
|||
import os
|
||||
import socket
|
||||
import time
|
||||
from urllib import parse
|
||||
|
||||
from ietfparse import algorithms, errors, headers
|
||||
from sprockets.mixins.mediatype import transcoders
|
||||
from tornado import httpclient
|
||||
|
||||
__version__ = '1.1.1'
|
||||
__version__ = '1.1.2'
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -317,6 +318,8 @@ class HTTPClientMixin:
|
|||
:rtype: tornado.concurrent.Future
|
||||
|
||||
"""
|
||||
parsed = parse.urlparse(response.request.url)
|
||||
duration = int(response.headers.get('Retry-After', 3))
|
||||
LOGGER.warning('Rate Limited by, retrying in %i seconds', duration)
|
||||
LOGGER.warning('Rate Limited by %s, retrying in %i seconds',
|
||||
parsed.netloc, duration)
|
||||
return asyncio.sleep(duration)
|
||||
|
|
Loading…
Reference in a new issue