Fix JSONDecodeError (#4241)

* Fix JSONDecodeError bug (#4237)

* Remove unused import

* Clean up code

* Fix JSONDecodeError (#4241)

* Accept all Exceptions

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
David Ai 2023-05-16 20:37:00 -07:00 committed by GitHub
parent 7664bb57f5
commit 39045d6eb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View File

@ -33,6 +33,7 @@ No changes to highlight.
- Fix "TypeError: issubclass() arg 1 must be a class" When use Optional[Types] by [@lingfengchencn](https://github.com/lingfengchencn) in [PR 4200](https://github.com/gradio-app/gradio/pull/4200).
- Ensure cancelling functions work correctly by [@pngwn](https://github.com/pngwn) in [PR 4225](https://github.com/gradio-app/gradio/pull/4225)
- Fixes a bug with typing.get_type_hints() on Python 3.9 by [@abidlabs](https://github.com/abidlabs) in [PR 4228](https://github.com/gradio-app/gradio/pull/4228).
- Fixes JSONDecodeError by [@davidai](https://github.com/davidai) in [PR 4241](https://github.com/gradio-app/gradio/pull/4241)
- Fix `chatbot_dialogpt` demo by [@dawoodkhan82](https://github.com/dawoodkhan82) in [PR 4238](https://github.com/gradio-app/gradio/pull/4238).
## Other Changes:

View File

@ -1,4 +1,3 @@
import json
import os
import threading
from typing import Dict
@ -38,11 +37,7 @@ def get_updated_messaging(en: Dict):
try:
updated_messaging = requests.get(MESSAGING_API_ENDPOINT, timeout=3).json()
en.update(updated_messaging)
except (
requests.ConnectionError,
requests.exceptions.ReadTimeout,
json.decoder.JSONDecodeError,
): # Use default messaging
except Exception: # Use default messaging
pass