File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 9
9
from github .Issue import Issue
10
10
from github .PaginatedList import PaginatedList
11
11
12
- TOKEN = os .getenv ("GITHUB_TOKEN" , "" )
13
12
ROOT = Path (__file__ ).parent .parent
14
13
conferences_path = ROOT / "_data/conferences.yml"
15
14
16
- auth = Auth .Token (TOKEN )
17
- g = Github (auth = auth )
18
15
16
+ def create_github_client ():
17
+ gh_token = os .getenv ("GITHUB_TOKEN" , "" )
18
+ auth = Auth .Token (gh_token )
19
+ g = Github (auth = auth )
20
+ return g
19
21
20
- def get_open_issues () -> PaginatedList [Issue ]:
21
- repo = g .get_repo ("BlackPythonDevs/blackpythondevs.github.io" )
22
+
23
+ def get_open_issues (gh : Github ) -> PaginatedList [Issue ]:
24
+ repo = gh .get_repo ("BlackPythonDevs/blackpythondevs.github.io" )
22
25
issues = repo .get_issues (state = "open" , labels = ["conference" ])
23
26
return issues
24
27
@@ -98,8 +101,11 @@ def write_conferences_to_file(confs: list[dict]):
98
101
if __name__ == "__main__" :
99
102
conferences = []
100
103
104
+ # Create Github client object
105
+ gh_client = create_github_client ()
106
+
101
107
# Get open issues from repo
102
- open_issues : PaginatedList [Issue ] = get_open_issues ()
108
+ open_issues : PaginatedList [Issue ] = get_open_issues (gh_client )
103
109
104
110
# Parse each conference issue so long as it has the "conference" label
105
111
for issue in open_issues :
You can’t perform that action at this time.
0 commit comments