Accept header to explicly use github api v3

Co-authored-by: Kayou <pierre@kayou.io>
This commit is contained in:
Alexandre Aubin 2021-01-20 15:12:07 +01:00 committed by GitHub
parent 7dc11c02aa
commit 17fa0fea3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

2
run.py
View file

@ -1036,7 +1036,7 @@ async def github(request):
# which is not represented in the original webhook
async def is_user_in_organization(user):
token = open("./github_bot_token").read().strip()
async with aiohttp.ClientSession(headers={"Authorization": f"token {token}"}) as session:
async with aiohttp.ClientSession(headers={"Authorization": f"token {token}", "Accept": "application/vnd.github.v3+json"}) as session:
await resp = session.get(f"https://api.github.com/orgs/YunoHost-Apps/members/{user}")
return resp.status == 204