mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-06 12:30:29 +08:00
Update client.py: raise error on 429 get_config (#9754)
* Update client.py: raise error on 429 get_config best not request to again * add changeset * lint * fix error --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
parent
88c8793276
commit
36a5076909
6
.changeset/chatty-pants-check.md
Normal file
6
.changeset/chatty-pants-check.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"gradio": patch
|
||||
"gradio_client": patch
|
||||
---
|
||||
|
||||
fix:Update client.py: raise error on 429 get_config
|
@ -869,9 +869,13 @@ class Client:
|
||||
raise AuthenticationError(
|
||||
f"Could not load {self.src} as credentials were not provided. Please login."
|
||||
)
|
||||
elif r.status_code == 429:
|
||||
raise utils.TooManyRequestsError(
|
||||
"Too many requests to the API, please try again later."
|
||||
) from None
|
||||
else: # to support older versions of Gradio
|
||||
r = httpx.get(
|
||||
self.src_prefixed,
|
||||
self.src,
|
||||
headers=self.headers,
|
||||
cookies=self.cookies,
|
||||
verify=self.ssl_verify,
|
||||
|
Loading…
x
Reference in New Issue
Block a user