You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseKeyError("\n\nOur time service requires a login/password to rate-limit. Please register for a free adafruit.io account and place the user/key in your secrets file under 'aio_username' and 'aio_key'")# pylint: disable=line-too-long
else: # we'll try to figure it out from the IP address
520
528
print("Getting time from IP address")
521
-
api_url=TIME_SERVICE_IPADDR
522
-
529
+
api_url=TIME_SERVICE% (aio_username, aio_key)
530
+
api_url+=TIME_SERVICE_STRFTIME
523
531
try:
524
532
response=requests.get(api_url)
525
-
time_json=response.json()
526
-
current_time=time_json['datetime']
527
-
year_day=time_json['day_of_year']
528
-
week_day=time_json['day_of_week']
529
-
is_dst=time_json['dst']
533
+
ifself._debug:
534
+
print("Time request: ", api_url)
535
+
print("Time reply: ", response.text)
536
+
times=response.text.split(' ')
537
+
the_date=times[0]
538
+
the_time=times[1]
539
+
year_day=int(times[2])
540
+
week_day=int(times[3])
541
+
is_dst=None# no way to know yet
530
542
exceptKeyError:
531
543
raiseKeyError("Was unable to lookup the time, try setting secrets['timezone'] according to http://worldtimeapi.org/timezones") # pylint: disable=line-too-long
raiseKeyError("\n\nOur image converter service require a login/password to rate-limit. Please register for a freeadafruit.io account and place the user/key in your secrets file under 'aio_username' and 'aio_key'")# pylint: disable=line-too-long
625
+
raiseKeyError("\n\nOur image converter service require a login/password to rate-limit. Please register for a free adafruit.io account and place the user/key in your secrets file under 'aio_username' and 'aio_key'")# pylint: disable=line-too-long
0 commit comments