Skip to content

Commit 24e197d

Browse files
committed
fix duplicate variable for url, correct status url
1 parent 7c2cb6c commit 24e197d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

examples/wifi/requests_wifi_advanced.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
ssid = os.getenv("CIRCUITPY_WIFI_SSID")
1616
password = os.getenv("CIRCUITPY_WIFI_PASSWORD")
1717

18-
JSON_GET_URL = "https://httpbin.org/get"
19-
STATUS_TEST = "https://httpbin.org/status/"
20-
2118
# Initalize Wifi, Socket Pool, Request Session
2219
pool = adafruit_connection_manager.get_radio_socketpool(wifi.radio)
2320
ssl_context = adafruit_connection_manager.get_radio_ssl_context(wifi.radio)
@@ -104,6 +101,8 @@ def print_http_status(code, description):
104101
"511": "Network Authentication Required",
105102
}
106103

104+
JSON_GET_URL = "https://httpbin.org/get"
105+
STATUS_TEST = "https://httpbin.org/status/"
107106

108107
print(f"\nConnecting to {ssid}...")
109108
print(f"Signal Strength: {rssi}")
@@ -114,8 +113,6 @@ def print_http_status(code, description):
114113
print(f"❌ OSError: {e}")
115114
print("✅ Wifi!")
116115

117-
JSON_GET_URL = "https://httpbin.org/get"
118-
119116
# Define a custom header as a dict.
120117
HEADERS = {"user-agent": "blinka/1.0.0"}
121118

@@ -134,8 +131,8 @@ def print_http_status(code, description):
134131
response.close()
135132
print(f" | ✂️ Disconnected from {JSON_GET_URL}")
136133
print(" | ")
137-
print(f" | Status Code Test: {JSON_GET_URL}")
138134

135+
print(f" | Status Code Test: {STATUS_TEST}")
139136
# Some return errors then confirm the error (that's a good thing)
140137
# Demonstrates not all errors have the same behavior
141138
# 300, 304, and 306 in particular

0 commit comments

Comments
 (0)