jrderuiter / pybiomart

A simple pythonic interface to biomart.
MIT License
55 stars 11 forks source link

Fixed urllib3 error. #18

Open dstrib opened 4 years ago

dstrib commented 4 years ago

When attempting to access archive Ensembl biomart servers such as: http://Apr2019.archive.ensembl.org , I kept receiving an error:

File "/apps/python3/3.6.5/lib/python3.6/site-packages/urllib3/response.py", line 543, in _update_chunk_length
    self.chunk_left = int(line, 16)

ValueError: invalid literal for int() with base 16: b''
[...]
  File "/apps/python3/3.6.5/lib/python3.6/site-packages/requests/models.py", line 748, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

I tracked it down to the cause mentioned here: https://github.com/psf/requests/issues/4248 I added an implementation of their proposed solution by replacing a urllib3 method, which allowes the successful utilization of old Ensembl archive biomart source url's.