eregs / regulations-parser

Parser for U.S. federal regulations and other regulatory information
Creative Commons Zero v1.0 Universal
36 stars 40 forks source link

Python3 fails with basic auth credentials in API URL #392

Open vrajmohan opened 6 years ago

vrajmohan commented 6 years ago

With python3, if the pipeline command is invoked with an http(s) URL output, and if basic auth credentials are supplied using the URL pattern https://user:password@rest-of-api-url, it may fail due to https://github.com/requests/requests/issues/4168 with the following message:

Traceback (most recent call last):
  File "/Users/cory/.pyenv/versions/3.6.0/lib/python3.6/encodings/idna.py", line 165, in encode
    raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long

On the FEC project, we worked around this issue by creating a .netrc file with basic auth credentials. See https://github.com/fecgov/fec-eregs/blob/develop/README.md#loading-fecs-regulations

vrajmohan commented 6 years ago

Optional arguments for credentials could be a solution.