20 lines
534 B
Python
20 lines
534 B
Python
import requests
|
|
import json
|
|
import urllib3
|
|
urllib3.disable_warnings()
|
|
|
|
# Let's test the widget API endpoint on homepage
|
|
url = "https://homepage.snarfnet.net/api/services/proxy?group=Environment%20%26%20Weather&service=Tempest%20Weather%20Station&index=0"
|
|
|
|
headers = {
|
|
"User-Agent": "Mozilla/5.0"
|
|
}
|
|
|
|
try:
|
|
r = requests.get(url, headers=headers, verify=False, timeout=10)
|
|
print("Status code:", r.status_code)
|
|
print("Response body:")
|
|
print(json.dumps(r.json(), indent=2))
|
|
except Exception as e:
|
|
print("Error:", e)
|