mixpanel-utils icon indicating copy to clipboard operation
mixpanel-utils copied to clipboard

_get_engage_page raises TypeError when request is rate limited

Open MaryFletcher opened this issue 2 years ago • 0 comments

_get_engage_page raises "TypeError: the JSON object must be str, bytes or bytearray, not NoneType" when the request fails with a 429 rate limited response.

The call to self.request in _get_engage_page on line 1956 doesn't return a value for HTTP error codes below 500. (See the logic for handling HTTP errors in request.) The next line in _get_engage_page calls json.loads(response) where response is None and a TypeError is raised.

I'm hitting the following:

WARNING: The server couldn't fulfill the request.
WARNING: Error code: 429
WARNING: Reason: Too Many Requests
...
File "/var/task/mixpanel_api/__init__.py", line 1631, in _get_engage_page
data = json.loads(response)
File "/var/lang/lib/python3.9/json/__init__.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

MaryFletcher avatar Dec 01 '22 21:12 MaryFletcher