Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 25, 2024
1 parent bdf85b9 commit 1282ffa
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions extra-scripts/rsync-active-users.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,22 @@ def get_all_users(hub_url, token):

while True:
url = f"{hub_url}/hub/api/users?offset={offset}&limit={limit}"
resp = requests.get(url, headers={
"Authorization": f"token {token}",
"Accept": "application/jupyterhub-pagination+json"
})
resp = requests.get(
url,
headers={
"Authorization": f"token {token}",
"Accept": "application/jupyterhub-pagination+json",
},
)

paginated_resp = resp.json()
users = paginated_resp['items']
pagination = paginated_resp.get('_pagination', {}).get('next', None)
users = paginated_resp["items"]
pagination = paginated_resp.get("_pagination", {}).get("next", None)
if pagination is None:
break
else:
offset = pagination['offset']
limit = pagination['limit']
offset = pagination["offset"]
limit = pagination["limit"]
for user in users:
if user["last_activity"]:
user["last_activity"] = parse(user.get("last_activity"))
Expand Down

0 comments on commit 1282ffa

Please sign in to comment.