DOI-BLM / requests-arcgis-auth

Authentication handler for using Esri ArcGIS for Server and Portal (ArcGIS Online) Token Authentication with Python Requests
22 stars 1 forks source link

OverflowError in 64-bit python when response payload is large #38

Open pfoppe opened 4 years ago

pfoppe commented 4 years ago

The authentication handler attempts to check the response for an expired token to re-generate if needed.
If the response content is large, python may throw an "OverflowError" which suggests a memory related issue.

File ... arcgis_saml_auth.py line 255, in _handle_response if resp.json().get("error") is not None: ... File ... sjisprober.py, line 54 in feed for i in range(0, aLen): OverflowError: range() result has too many items

The URL call where this failed reported a content-length of 2578621883

pfoppe commented 4 years ago

Possible fix is to add the following code to ArcGIS_saml_auth.py at line 275:

        # Unable to parse JSON data due to a memory error.  Requestor could ask for a large payload that is not JSON response.  Throw away exception for now and assume the token was still valid.
        except OverflowError:
            pass