pydexcom icon indicating copy to clipboard operation
pydexcom copied to clipboard

Session Errors

Open connorgillespie opened this issue 2 years ago • 4 comments

Hi, I just had a question regarding the following error. Is this something that is fixable on my end or am I being API limited? The error happens after about an hour of consistently pulling the current readings every 30 seconds. Thanks!

dexcom = Dexcom(self._credentials["username"], self._credentials["password"])
dexcom.create_session()  
bg = dexcom.get_current_glucose_reading()

image

connorgillespie avatar Jun 30 '22 02:06 connorgillespie

I'd be surprised if it's an API rate limit. You're not pegging it at something silly like a request a second, haha. Are you running just this line every 30 seconds?

bg = dexcom.get_current_glucose_reading()

For what it's worth, the create_session and overall session handling is handled by the call to get_current_glucose_reading -- no need for the separate call to create_session.

gagebenne avatar Jun 30 '22 02:06 gagebenne

I have to agree with that because the Dexcom API has a limit of 60,000 requests per hour, so I was very confused when I saw that haha. I will remove the create_session call since it is unnecessary.

Regarding the code being executed, the bg.value is pumped into a few different algorithms and the data is stored via MySQL. The whole script is synchronous and the goal in mind was to try to predict the next BG level with linear regression. This data would let me trigger some warning notifications in the event of a low BG level overnight.

I already tried researching the 504 error with the MySQL connector, but no luck. I saw an older issue in here regarding a Session ID being stated as default or something along those lines. The error seemed like it was coming from this library. Any clue why?

connorgillespie avatar Jun 30 '22 05:06 connorgillespie

Ah. I started picking up sessions errors this morning as well (it's been stable for 6+ months). My assumption is that the API has been tweaked. Looking into it.

gagebenne avatar Jun 30 '22 15:06 gagebenne

No worries and thanks for looking into it!

connorgillespie avatar Jun 30 '22 18:06 connorgillespie

Did anyone ever determine what the rate is? I’ve got a script that kicks off every 5 minutes and it keeps getting caught up in it

chakachim avatar Mar 03 '23 05:03 chakachim

The API seems stable again. Thanks everyone!

gagebenne avatar Apr 21 '23 21:04 gagebenne