Having difficulty parsing json from GitHub api. I'm trying to populate a team with all the repos from an organisation. I'm using myteamname to obtain the teamid required for the loop which populates the team with the repo names.
import json
import requests
mytokenid = "xxx"
myorg = "xxx"
myteamname = "xxx"
headers = {
'Authorization': 'token %s' % mytokenid,
}
response = requests.get('https://api.github.com/orgs/{0}/teams/{1}'.format(myorg, myteamname), headers=headers)
teamidjson = json.loads(response.text)
myteamid = teamidjson(['id'])
g = Github(tokenid)
for repo in g.get_organization(myorg).get_repos():
myreponame = repo.name
response = requests.put('https://api.github.com/teams/{0}/repos/{1}/{2}'.format(myteamid, myorg, myreponame), headers=headers)
I get this error message
File "githubteam.py", line 74, in <module>
myteamid = teamidjson(['id'])
TypeError: 'dict' object is not callable