twitter api ("Connection broken: Invalid Chunk Length(got length b'', 0 bytes read)" 1

twitter api (“Connection broken: Invalid Chunk Length(got length b”, 0 bytes read)”

r = ''
while r == '':
    try:
        r = requests.get(Url, headers = headers)
    except (requests.exceptions.ConnectionError, requests.exceptions.ChunkedEncodingError) as err:
        log_(err + ' Put to sleep before retrying.')
        time.sleep(100)
        continue

Here is what the above code is Doing:
1. We’re using the requests library to make a GET request to the URL we defined above.
2. We’re passing in the headers we defined above as a parameter to the GET request.
3. We’re using a while loop to keep trying to make the GET request until we get a response.
4. If we get a response, we break out of the while loop.
5. If we don’t get a response, we wait 100 seconds and try again.

Similar Posts