Skip to content

Commit c562a91

Browse files
authored
Merge pull request #130 from eth-cscs/requests-timeouts
Add timeouts to call to requests
2 parents 797ced5 + babf845 commit c562a91

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

firecrestspawner/singleuser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def main(argv=None):
1717
url=url_path_join(hub_auth.api_url, "firecrestspawner"),
1818
headers={"Authorization": f"token {hub_auth.api_token}"},
1919
json={"port": port},
20+
timeout=30
2021
)
2122
cmd_path = which(sys.argv[1])
2223
sys.argv = sys.argv[1:] + ["--port={}".format(port)]

firecrestspawner/spawner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def get_access_token(self) -> Optional[str]:
107107
"refresh_token": self.refresh_token,
108108
}
109109
headers = {"Content-Type": "application/x-www-form-urlencoded"}
110-
response = requests.post(self.token_url, data=params, headers=headers)
110+
response = requests.post(self.token_url, data=params, headers=headers, timeout=30)
111111

112112
if response.status_code != 200:
113113
# if the refresh token is expired, Keycloak returns

0 commit comments

Comments
 (0)