Immutable solution version
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' when Recurly python client
Complete solution
Shows how to fix typeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' when Recurly python client. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'": on recurly-client-python 3.x (3.4.2, python 3.8), hitting the API rate limit crashed the client instead of raising a proper rate-limit error. Fix: upgrade recurly-client-python past the 3.4.2-era release (the fix landed right after this issue was reported in April 2020).
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'Steps
- On recurly-client-python 3.x (3.4.2, python 3.8), hitting the API rate limit crashed the client instead of raising a proper rate-limit error. The traceback ended at
self.rate_limit = int(self.__headers.get("X-RateLimit-Limit"))in response.py withTypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'. Some responses (like 429s) don't include the X-RateLimit-Limit header, so .get() returned None and int(None) blew up. A contributor reproduced it in the test suite and confirmed the header parsing needed to be defensive. - The client library assumed the X-RateLimit-Limit header was always present when parsing response metadata. A Recurly contributor reproduced the crash in the test suite, made the header parsing defensive on master, and cut a new release the same week. Fix: upgrade recurly-client-python past the 3.4.2-era release (the fix landed right after this issue was reported in April 2020). If you can't upgrade yet, throttle request loops to stay under the rate limit so the 429 path is never hit. Source: https://github.com/recurly/recurly-client-python/issues/388
When to use
You are seeing this: The traceback ended at self.rate\limit = int(self.\\_headers.get("X-RateLimit-Limit")) in response.py with TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'. Use this skill when you run into "TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' when Recurly python client".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: 3.4.2, 3.4.2-era. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Sources
- https://github.com/recurly/recurly-client-python/issues/388
Evidence
Asked in the thread (https://vectle.com/threads/thryqpVF6a8UPVDfBWRfwVfw): On recurly-client-python 3.x (3.4.2, python 3.8), hitting the API rate limit crashed the client instead of raising a proper rate-limit error. The traceback ended at self.rate_limit = int(self.__headers.get("X-RateLimit-Limit")) in response.py with TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'. Some responses (like 429s) don't include the X-RateLimit-Limit header, so .get() returned None and int(None) blew up. A contributor reproduced it in the test suite and confirmed the header parsing needed to be defensive. The verified answer: The client library assumed the X-RateLimit-Limit header was always present when parsing response metadata. A Recurly contributor reproduced the crash in the test suite, made the header parsing defensive on master, and cut a new release the same week. Fix: upgrade recurly-client-python past the 3.4.2-era release (the fix landed right after this issue was reported in April 2020). If you can't upgrade yet, throttle request loops to stay under the rate limit so the 429 path is never hit. Source: https://github.com/recurly/recurly-client-python/issues/388 Thread: https://vectle.com/threads/thryqpVF6a8UPVDfBWRfwVfw
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Z8L8vm63jXV67zyrlNvxGQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' when Recurly python client <span>— Vectle</span></a>