pimutils / pimutils/vdirsyncer
Respect HTTP header 'Retry-After'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 185
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 1
Description
I am trying to migrate from Google Calendar to mailbox.org, but syncing fails because I eventually run into mailbox.org's rate limit (see details below).
It would be nice if vdirsyncer respected the Retry-After header in HTTP 429 responses and waited either the given amount of seconds or until a certain time instance, if such is given instead.
- Your vdirsyncer version: 0.16.4
- If applicable, which server software (and which version) you're using: mailbox.org
- Your Python version: Python 3.6.5
- Your operating system: Arch Linux \r (\l)
- Your config file: vdirsync_config.txt
- Use
vdirsyncer -vdebugfor debug output.
debug: Sending request...
debug: 429
debug: {'Date': 'Mon, 07 May 2018 21:50:53 GMT', 'Server': 'grizzly/2.3.29', 'X-Robots-Tag': 'none', 'Retry-After': '300', 'Content-Type': 'text/html;charset=UTF-8', 'Content-Length': '261', 'Strict-Transport-Security': 'max-age=15768000', 'Keep-Alive': 'timeout=5, max=40', 'Connection': 'Keep-Alive'}
debug: <!DOCTYPE html>
debug: <html><head>
debug: <title>429 Too Many Requests - Your request is being rate limited.</title>
debug: </head><body>
debug: <h1>Too Many Requests - Your request is being rate limited.</h1>
debug: <p>Too Many Requests - Your request is being rate limited.</p>
debug: </body></html>
error: Unknown error occured for calendars__local_google__mailbox/main: 429 Client Error: Too Many Requests - Your request is being rate limited. for url: https://dav.mailbox.org/caldav/<redacted>/<redacted>.ics
error: Use `-vdebug` to see the full traceback.
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/cli/utils.py", line 74, in handle_cli_error
debug: raise e
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/sync/__init__.py", line 153, in sync
debug: partial_sync
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/sync/__init__.py", line 177, in run
debug: self._run_impl(a, b)
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/sync/__init__.py", line 204, in _run_impl
debug: href, etag = self.dest.storage.upload(self.item)
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/storage/base.py", line 15, in inner
debug: return f(self, *args, **kwargs)
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/storage/base.py", line 15, in inner
debug: return f(self, *args, **kwargs)
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/storage/dav.py", line 562, in upload
debug: return self._put(href, item, None)
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/storage/dav.py", line 531, in _put
debug: headers=headers
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/storage/dav.py", line 390, in request
debug: return http.request(method, url, session=self._session, **more)
debug: File "/usr/lib/python3.6/site-packages/vdirsyncer/http.py", line 183, in request
debug: r.raise_for_status()
debug: File "/usr/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status
debug: raise HTTPError(http_error_msg, response=self)
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
Read vdirsyncer/http.py at request(), where the traceback shows 429 responses become errors, then inspect the callers in vdirsyncer/storage/dav.py. Done means a 429 response honors Retry-After as either seconds or an HTTP date before continuing, while other error handling remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100