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

Crash in Python HTTP client when using a proxy #319

Open
bellegarde-c opened this issue Feb 5, 2020 · 0 comments
Open

Crash in Python HTTP client when using a proxy #319

bellegarde-c opened this issue Feb 5, 2020 · 0 comments

Comments

@bellegarde-c
Copy link

bellegarde-c commented Feb 5, 2020

What did you do?

Trying to connect with a proxy enabled

What did you expect to happen?

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pylast/__init__.py", line 917, in _download_response
    conn.request(
  File "/usr/lib/python3.8/http/client.py", line 1230, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1276, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1225, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1004, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 944, in send
    self.connect()
  File "/usr/lib/python3.8/http/client.py", line 1392, in connect
    super().connect()
  File "/usr/lib/python3.8/http/client.py", line 915, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.8/socket.py", line 808, in create_connection
    raise err
  File "/usr/lib/python3.8/socket.py", line 791, in create_connection
    sock = socket(af, socktype, proto)
  File "/usr/lib/python3.8/socket.py", line 231, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 97] Address family not supported by protocol

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/pylast/__init__.py", line 1078, in get_session_key
    doc = request.execute()
  File "/usr/lib/python3.8/site-packages/pylast/__init__.py", line 951, in execute
    response = self._download_response()
  File "/usr/lib/python3.8/site-packages/pylast/__init__.py", line 924, in _download_response
    raise NetworkError(self.network, e)
pylast.NetworkError: NetworkError: [Errno 97] Address family not supported by protocol

What versions of OS, Python and pylast are you using?

ArchLinux:
-python 3.8.1-4
-python-pylast 3.2.0-1

from pylast import LastFMNetwork, LibreFMNetwork, md5, WSError
from pylast import SessionKeyGenerator
API_KEY = "******************"
API_SECRET = ""******************""
last=LastFMNetwork(api_key=API_KEY, api_secret=API_SECRET)
last.enable_proxy("localhost", 8888)
skg = SessionKeyGenerator(last)
skg.get_session_key(username="*****", password_hash=md5("*******"))
@bellegarde-c bellegarde-c changed the title SSL: WRONG_VERSION_NUMBER when using a proxy Crash in python http client when using a proxy Feb 5, 2020
@hugovk hugovk changed the title Crash in python http client when using a proxy Crash in Python HTTP client when using a proxy Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant