Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Sun, 30 Jun 2019 12:08:45 UTC Commit: 52941f97ac36ae834b4ecd65c93bdab7f034372c https://github.com/geany/www.geany.org/commit/52941f97ac36ae834b4ecd65c93bda...
Log Message: ----------- Log request duration of Github API calls
Modified Paths: -------------- static_docs/github_client.py
Modified: static_docs/github_client.py 9 lines changed, 9 insertions(+), 0 deletions(-) =================================================================== @@ -41,6 +41,7 @@ def get_file_contents(self, filename, user=None, repository=None): with requests.get(url, timeout=HTTP_REQUEST_TIMEOUT, stream=False) as response: response_json = response.json() self._log_rate_limit(response) + self._log_request(response)
# parse response return self._parse_fetch_file_response(response_json) @@ -51,6 +52,14 @@ def _log_rate_limit(self, response): rate_limit = response.headers['X-RateLimit-Limit'] logger.info('Github rate limits: %s/%s', rate_limit_remaining, rate_limit)
+ # ---------------------------------------------------------------------- + def _log_request(self, response): + logger.info( + 'Requesting "{} {}" took {}s'.format( + response.request.method, + response.request.url, + response.elapsed.total_seconds())) + # ---------------------------------------------------------------------- def _parse_fetch_file_response(self, response_json): content = response_json['content']
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).