diff options
author | Tobias Henkel <tobias.henkel@bmw.de> | 2017-12-20 16:43:46 +0100 |
---|---|---|
committer | Tobias Henkel <tobias.henkel@bmw.de> | 2017-12-20 19:49:03 +0100 |
commit | 38f4ea353a524f95f934c21812b7ca192d77ada6 (patch) | |
tree | 0a0c8ec913cf26f8fa6c23b28670f09ecf636762 | |
parent | 17a4ae8c780596dcf622ebc05340a257e87d5f09 (diff) | |
download | zuul-38f4ea353a524f95f934c21812b7ca192d77ada6.tar.gz |
Add github debugging template
This is a small hacky github debugging template script for testing
github issues.
Change-Id: I9b8d1e9c2ad85eec0ea81527e97c162e8695124a
-rw-r--r-- | tools/github-debugging.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/github-debugging.py b/tools/github-debugging.py new file mode 100644 index 000000000..171627ab9 --- /dev/null +++ b/tools/github-debugging.py @@ -0,0 +1,55 @@ +import github3 +import logging +import time + +# This is a template with boilerplate code for debugging github issues + +# TODO: for real use override the following variables +url = 'https://example.com' +api_token = 'xxxx' +org = 'org' +project = 'project' +pull_nr = 3 + + +# Send the logs to stderr as well +stream_handler = logging.StreamHandler() + + +logger_urllib3 = logging.getLogger('requests.packages.logger_urllib3') +# logger_urllib3.addHandler(stream_handler) +logger_urllib3.setLevel(logging.DEBUG) + +logger = logging.getLogger('github3') +# logger.addHandler(stream_handler) +logger.setLevel(logging.DEBUG) + + +github = github3.GitHubEnterprise(url) + + +# This is the currently broken cache adapter, enable or replace it to debug +# caching + +# import cachecontrol +# from cachecontrol.cache import DictCache +# cache_adapter = cachecontrol.CacheControlAdapter( +# DictCache(), +# cache_etags=True) +# +# github.session.mount('http://', cache_adapter) +# github.session.mount('https://', cache_adapter) + + +github.login(token=api_token) + +i = 0 +while True: + pr = github.pull_request(org, project, pull_nr) + prdict = pr.as_dict() + issue = pr.issue() + labels = list(issue.labels()) + print(labels) + i += 1 + print(i) + time.sleep(1) |