Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib.parse.urlparse change of behavior using url with port in python3.9 #129

Open
vincentBaer opened this issue Dec 10, 2021 · 0 comments

Comments

@vincentBaer
Copy link

vincentBaer commented Dec 10, 2021

Test without venv in centos7 and in docker python3.9.3 also.
Version: v1.7.1
Python3: 3.9.3
Config:

{"default":
    {"access_key": "ak",
      "secret_key": "sk",
      "host": "outscale.com:443",
      "https": true,
      "method": "POST",
      "region_name": "eu-west-2"
    }
}  

Command launch:

osc-cli api ReadLoadBalancers

You have now :

requests.exceptions.InvalidSchema: No connection adapters were found for 'api.eu-west-2.outscale.com:443//api/latest/ReadLoadBalancers' 

Instead of with version python3.7 or python3.6:

osc_sdk.sdk.OscApiException: Error --> status = 401, code = 1, Reason = AccessDenied, request_id = 93acf326-9269-4abb-98b0-c5257c417270 

With more investigation the issue is linked with the behavior of urllib.parse.urlparse (the same version in python3.7 and python 3.9 (urllib3==1.24.3)) https://github.com/outscale/osc-cli/blob/master/osc_sdk/sdk.py#L194

In python3.7:

ParseResult(scheme='', netloc='', path='api.eu-west-2.outscale.com:443', params='', query='', fragment='')

In python3.9:

ParseResult(scheme='api.eu-west-2.outscale.com', netloc='', path='443', params='', query='', fragment='')

https://docs.python.org/3/library/urllib.parse.html (Following the syntax specifications in RFC 1808, urlparse recognizes a netloc only if it is properly introduced by ‘//’)

If you have add '//' in endpoint to respect RFC 1808, urllib.parse.urlparse parse correctly:

ParseResult(scheme='', netloc='', path='api.eu-west-2.outscale.com:443', params='', query='', fragment='')
@vincentBaer vincentBaer changed the title urllib.parse.urlparse change of behavior with url in python3.9 urllib.parse.urlparse change of behavior using url with port in python3.9 Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant