mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-23 11:39:17 +08:00
Patching test_get_ip
attempt 2 (#2810)
* ip-patch-2 * formatting * patch 2
This commit is contained in:
parent
b492212c02
commit
5182460886
@ -17,6 +17,8 @@ No changes to highlight.
|
||||
|
||||
## Full Changelog:
|
||||
* Fixed typo in parameter `visible` in classes in `templates.py` by [@abidlabs](https://github.com/abidlabs) in [PR 2805](https://github.com/gradio-app/gradio/pull/2805)
|
||||
* Switched external service for getting IP address from `https://api.ipify.org` to `https://checkip.amazonaws.com/` by [@abidlabs](https://github.com/abidlabs) in [PR 2810](https://github.com/gradio-app/gradio/pull/2810)
|
||||
|
||||
|
||||
## Contributors Shoutout:
|
||||
No changes to highlight.
|
||||
|
@ -78,8 +78,11 @@ def version_check():
|
||||
|
||||
|
||||
def get_local_ip_address() -> str:
|
||||
"""Gets the public IP address or returns the string "No internet connection" if unable to obtain it."""
|
||||
try:
|
||||
ip_address = requests.get("https://api.ipify.org", timeout=3).text
|
||||
ip_address = requests.get(
|
||||
"https://checkip.amazonaws.com/", timeout=3
|
||||
).text.strip()
|
||||
except (requests.ConnectionError, requests.exceptions.ReadTimeout):
|
||||
ip_address = "No internet connection"
|
||||
return ip_address
|
||||
|
@ -103,6 +103,7 @@ class TestUtils:
|
||||
|
||||
|
||||
class TestIPAddress:
|
||||
@pytest.mark.flaky
|
||||
def test_get_ip(self):
|
||||
ip = get_local_ip_address()
|
||||
if ip == "No internet connection":
|
||||
|
Loading…
Reference in New Issue
Block a user