Fix internal tracker update

This commit is contained in:
Gabriel Augendre 2021-02-07 08:31:51 +01:00
parent c39ddc490f
commit fd87042003

View file

@ -6,16 +6,17 @@ BASE_URL = "https://git.augendre.info/api/v1"
def main(): def main():
session = requests.Session() session = requests.Session()
session.headers.update({"Authorization": f"token {GITEA_TOKEN}"}) session.headers.update({"Authorization": f"token {GITEA_TOKEN}"})
res = session.get(f"{BASE_URL}/user/repos", params={"limit": 1}) res = session.get(f"{BASE_URL}/user/repos", params={"limit": 40})
repos = res.json() repos = res.json()
for repo in repos: for repo in repos:
full_name = repo["full_name"] full_name = repo["full_name"]
url = f"{BASE_URL}/repos/{full_name}" url = f"{BASE_URL}/repos/{full_name}"
res = session.patch(url, json={ res = session.patch(url, json={
'has_issues': True,
'internal_tracker': {'enable_time_tracker': False, 'allow_only_contributors_to_track_time': True, 'enable_issue_dependencies': True} 'internal_tracker': {'enable_time_tracker': False, 'allow_only_contributors_to_track_time': True, 'enable_issue_dependencies': True}
}) })
print(res.json()) print(full_name, res.status_code)
if __name__ == "__main__": if __name__ == "__main__":