Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
Remove user:password from URL
Browse files Browse the repository at this point in the history
Due to psf/requests#4168, using https://user:password@url makes the
URL too long and results in a UnicodeError: "label empty or too long".

The workaround is to avoid specifying it in the URL and to use an
alternate mechanism of supplying credentials e.g. .netrc.
  • Loading branch information
Vraj Mohan committed Apr 11, 2018
1 parent 7934315 commit 2274c24
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions load_regs/load_fec_regs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
manage.main(['manage.py', 'migrate', '--fake-initial'])

with open('load_regs/fec_reg_parts.txt')as parts:
if sys.argv[1] == 'local':
env = sys.argv[1].strip()
if env == 'local':
url = 'http://localhost:8000/api'
else:
env, http_auth_user, http_auth_password = sys.argv[1:]
url = "https://{0}:{1}@fec-{2}-eregs.app.cloud.gov/regulations/api" \
.format(http_auth_user.strip(), http_auth_password.strip(), env.strip())
print(url)
url = "https://fec-{0}-eregs.app.cloud.gov/regulations/api".format(env)

for part in parts:
args = ['manage.py', 'eregs', 'pipeline', '11', part,
Expand Down

0 comments on commit 2274c24

Please sign in to comment.