Add pico display feedback
This commit is contained in:
@@ -39,20 +39,25 @@ def wifi_connect(SSID:str, PASSWORD:str) -> None:
|
||||
|
||||
|
||||
# send a HTTP-request to the access point with the rate value
|
||||
def send_request(user_id:int, rating:int) -> None:
|
||||
def send_request(user_id:int, rating:int) -> bool:
|
||||
|
||||
# create HTTP-URL
|
||||
URL = f"http://{IP_ADRESS_SERVER}:{str(SERVER_PORT)}/ratings/{user_id}/{rating}"
|
||||
print(URL)
|
||||
|
||||
# create request
|
||||
response = urequests.get(URL)
|
||||
try:
|
||||
# create request
|
||||
response = urequests.get(URL)
|
||||
|
||||
# print HTTP-answer of the access point
|
||||
print("Server response:")
|
||||
print(response.text)
|
||||
print()
|
||||
response.close()
|
||||
# print HTTP-answer of the access point
|
||||
print("Server response:")
|
||||
print(response.text)
|
||||
print()
|
||||
response.close()
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Request failed: {e}")
|
||||
return False
|
||||
|
||||
|
||||
# test, if there can be a connection to the given ip adress and port
|
||||
|
||||
Reference in New Issue
Block a user