Open rossowl opened 1 month ago
Hi,
Do you still have this problem? This is not a diyhue issue. Github limits the request per hour per user. https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28
How did you get this error to occur? The rate limit is 60 request per hour.
Mark
GitHub DocsLearn about REST API rate limits, how to avoid exceeding them, and what to do if you do exceed them.
I had hass rest sensor for zigbee2mqtt latest version with frequency 30 sec. After half of every hour github returns message with status code != 200. The is publish_time undefined.
def githubCheck(): creation_time = subprocess.run("stat -c %y HueEmulator3.py", shell=True, capture_output=True, text=True)#2024-02-18 19:50:15.000000000 +0100\n
#...
response = requests.get(url)
# status code is not 200, this code is skipped
if response.status_code == 200:
#...
device_data = json.loads(response.text)
# here is publish_time defined but only if status_code == 200
publish_time = datetime.strptime(device_data["commit"]["commit"]["author"]["date"], "%Y-%m-%dT%H:%M:%SZ").strftime("%Y-%m-%d %H")
# end of skipped code when status code != 200
# this line is always processed
logging.info("creation_time diyHue : " + str(creation_time))
logging.info("publish_time diyHue : " + str(publish_time))
I think it is now fixed
Issue does not already exist?
I have searched and found no existing issue
Select Environment
Docker
Home Assistant related?
No
Description
UnboundLocalError: cannot access local variable 'publish_time' where it is not associated with a value
logging.info("publish_time diyHue : " + str(publish_time))
GitHub API: {"message":"API rate limit exceeded for .....
Errorlog:
`2024-06-01 13:23:21,617 - services.updateManager - INFO - creation_time diyHue : 2024-05-28 19
Traceback (most recent call last):
File "/opt/hue-emulator/HueEmulator3.py", line 115, in
File "/opt/hue-emulator/services/updateManager.py", line 110, in startupCheck
File "/opt/hue-emulator/services/updateManager.py", line 50, in githubCheck
UnboundLocalError: cannot access local variable 'publish_time' where it is not associated with a value
Exception ignored in: <function Group.del at 0xf67ec5c8>
Traceback (most recent call last):
File "/opt/hue-emulator/HueObjects/init.py", line 1051, in del
ImportError: sys.meta_path is None, Python is likely shutting down`
Steps to reproduce
start container
Please enter your operating system details here
Debian
What DiyHue version(branch) are you using?
master (latest)