Skip to content

Commit 2125dda

Browse files
committed
consolidate headers
1 parent 7cb3e14 commit 2125dda

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

private-sec-reporting.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
orgs = ["jupyter", 'ipython', 'jupyterhub', 'jupyterlab']
1010
token = os.getenv("GH_TOKEN")
11+
headers = {
12+
'Authorization': f'token {token}',
13+
'Accept': 'application/vnd.github.v3+json'
14+
}
1115

1216
async def check_private_vulnerability_reporting(session, org, repo_name):
13-
headers = {
14-
'Authorization': f'token {token}',
15-
'Accept': 'application/vnd.github.v3+json'
16-
}
1717
url = f'https://api.github.com/repos/{org}/{repo_name}/private-vulnerability-reporting'
1818

1919
async with session.get(url, headers=headers) as response:
@@ -23,11 +23,6 @@ async def check_private_vulnerability_reporting(session, org, repo_name):
2323
return False
2424

2525
async def get_org_repos(session, org):
26-
headers = {
27-
'Authorization': f'token {token}',
28-
'Accept': 'application/vnd.github.v3+json'
29-
}
30-
3126
repos = []
3227
page = 1
3328
while True:
@@ -49,10 +44,6 @@ async def get_org_repos(session, org):
4944
async def main():
5045
async with aiohttp.ClientSession() as session:
5146
# Check rate limit before making requests
52-
headers = {
53-
'Authorization': f'token {token}',
54-
'Accept': 'application/vnd.github.v3+json'
55-
}
5647
async with session.get('https://api.github.com/rate_limit', headers=headers) as response:
5748
if response.status == 200:
5849
rate_data = await response.json()

0 commit comments

Comments
 (0)