blob: 171627ab96499fdaaf58f26645fbda7a9a1029e1 [file] [log] [blame]
Tobias Henkel38f4ea32017-12-20 16:43:46 +01001import github3
2import logging
3import time
4
5# This is a template with boilerplate code for debugging github issues
6
7# TODO: for real use override the following variables
8url = 'https://example.com'
9api_token = 'xxxx'
10org = 'org'
11project = 'project'
12pull_nr = 3
13
14
15# Send the logs to stderr as well
16stream_handler = logging.StreamHandler()
17
18
19logger_urllib3 = logging.getLogger('requests.packages.logger_urllib3')
20# logger_urllib3.addHandler(stream_handler)
21logger_urllib3.setLevel(logging.DEBUG)
22
23logger = logging.getLogger('github3')
24# logger.addHandler(stream_handler)
25logger.setLevel(logging.DEBUG)
26
27
28github = github3.GitHubEnterprise(url)
29
30
31# This is the currently broken cache adapter, enable or replace it to debug
32# caching
33
34# import cachecontrol
35# from cachecontrol.cache import DictCache
36# cache_adapter = cachecontrol.CacheControlAdapter(
37# DictCache(),
38# cache_etags=True)
39#
40# github.session.mount('http://', cache_adapter)
41# github.session.mount('https://', cache_adapter)
42
43
44github.login(token=api_token)
45
46i = 0
47while True:
48 pr = github.pull_request(org, project, pull_nr)
49 prdict = pr.as_dict()
50 issue = pr.issue()
51 labels = list(issue.labels())
52 print(labels)
53 i += 1
54 print(i)
55 time.sleep(1)