unioslo / unioslo/mreg-cli

URL without scheme raises uncaught `MissingSchema` exception

Open
#339 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2
Forks
7
Avg merge
6d 11h
Merged PRs (30d)
2

Description

[pederhan@auspex ~]$ mreg-cli --url example.com
Traceback (most recent call last):
  File "run.py", line 21, in <module>
  File "mreg_cli/main.py", line 150, in main
  File "mreg_cli/utilities/api.py", line 117, in try_token_or_login
  File "requests/sessions.py", line 602, in get
  File "requests/sessions.py", line 575, in request
  File "requests/sessions.py", line 484, in prepare_request
  File "requests/models.py", line 367, in prepare
  File "requests/models.py", line 438, in prepare_url
requests.exceptions.MissingSchema: Invalid URL '/api/v1/hosts/': No scheme supplied. Perhaps you meant https:///api/v1/hosts/?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the command with mreg-cli --url example.com, then inspect mreg_cli/main.py and mreg_cli/utilities/api.py, especially the try_token_or_login path shown in the traceback. Determine how URLs without a scheme should be handled and verify that the command no longer exposes an uncaught requests.exceptions.MissingSchema error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.