Consider permissions
This commit is contained in:
parent
ff783f41da
commit
334546209a
20
main.py
20
main.py
@ -8,8 +8,22 @@ headers = {
|
||||
'Authorization': f'token {config.TOKEN}'
|
||||
}
|
||||
|
||||
url = f'{GITEA_INSTANCE}/api/v1/repos/Benjamin_Loison/Synchronous_reactive_systems/collaborators'
|
||||
def getApi(url):
|
||||
url = f'{GITEA_INSTANCE}/api/v1/{url}'
|
||||
response = requests.get(url, headers = headers)
|
||||
return response.json()
|
||||
|
||||
collaborators = requests.get(url, headers = headers).json()
|
||||
repositories = getApi(f'user/repos')
|
||||
|
||||
print(json.dumps(repositories, indent = 4))
|
||||
|
||||
for repository in repositories:
|
||||
repositoryFullName = repository['full_name']
|
||||
collaborators = getApi(f'repos/{repositoryFullName}/collaborators')
|
||||
for collaborator in collaborators:
|
||||
print(json.dumps(collaborators, indent = 4))
|
||||
permission = getApi(f'repos/{repositoryFullName}/collaborators/{collaborator["login"]}/permission')
|
||||
if permission['permission'] != 'read':
|
||||
print(repositoryFullName)
|
||||
print(json.dumps(permission, indent = 4))
|
||||
|
||||
print(json.dumps(collaborators, indent = 4))
|
Loading…
Reference in New Issue
Block a user