zytedata / zytedata/python-zyte-api
Add URL to Logs when Retrying
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Python
- Stars
- 30
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
Currently, this section of the code https://github.com/zytedata/python-zyte-api/blob/main/zyte_api/aio/client.py#L62-L130 produces this DEBUG log when retrying errors:
[zyte_api.aio.retry] Retrying zyte_api.aio.client.AsyncClient.request_raw.<locals>.request in 7.430951650096189 seconds as it raised RequestError: RequestError: 520, message=, headers=<CIMultiDictProxy('Date': 'Tue, 19 Dec 2023 09:07:00 GMT', 'Content-Type': 'application/problem+json', 'Content-Length': '301', 'Connection': 'keep-alive', 'Retry-After': '60', 'Request-Id': '8dc64f033de37f442807c9d378c5044b', 'Vary': 'Accept-Encoding', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Expose-Headers': '*, X-Project-Key', 'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, PATCH, OPTIONS', 'Access-Control-Allow-Headers': 'DNT, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range, Authorization, X-Project-Key', 'Access-Control-Max-Age': '1728000')>, body=b'{"type":"/download/temporary-error","title":"Temporary Downloading Error","status":520,"detail":"There is a downloading problem which might be temporary. Retry in N seconds from \'Retry-After\' header or open a support ticket from https://support.zyte.com/support/tickets/new if it fails consistently."}', request_id=8dc64f033de37f442807c9d378c5044b.
Notice that the URL of the request in isn't logged here, but the header is.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in zyte_api/aio/client.py, especially the retry-related code at lines 62–130, and inspect how the DEBUG retry message is assembled. Update the log so it includes the request URL, then verify that retry messages contain the URL while retaining the existing error details.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100