Support for requests 2.x #219

Closed
fletom opened this Issue Nov 15, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@fletom

fletom commented Nov 15, 2013

When requests 2.x gets installed with pip, I always get this traceback:

Elendil:~ tomalty$ livestreamer http://www.twitch.tv/taketv best --player "/Applications/VLC.app/Contents/MacOS/VLC --file-caching 2000"
[cli][info] Found matching plugin twitch for URL http://www.twitch.tv/taketv
Traceback (most recent call last):
  File "/usr/local/bin/livestreamer", line 8, in <module>
    load_entry_point('livestreamer==1.7.0', 'console_scripts', 'livestreamer')()
  File "/Library/Python/2.6/site-packages/livestreamer_cli/main.py", line 653, in main
    handle_url()
  File "/Library/Python/2.6/site-packages/livestreamer_cli/main.py", line 422, in handle_url
    streams = fetch_streams(plugin)
  File "/Library/Python/2.6/site-packages/livestreamer_cli/main.py", line 366, in fetch_streams
    sorting_excludes=args.stream_sorting_excludes)
  File "/Library/Python/2.6/site-packages/livestreamer/plugin/plugin.py", line 219, in get_streams
    ostreams = self._get_streams()
  File "/Library/Python/2.6/site-packages/livestreamer/plugins/justintv_common.py", line 300, in _get_streams
    return self._get_live_streams()
  File "/Library/Python/2.6/site-packages/livestreamer/plugins/twitch.py", line 138, in _get_live_streams
    sig, token = self._access_token()
  File "/Library/Python/2.6/site-packages/livestreamer/plugins/twitch.py", line 103, in _access_token
    sig, token = self.api.channel_access_token(self.channel)
  File "/Library/Python/2.6/site-packages/livestreamer/plugins/twitch.py", line 49, in channel_access_token
    res = self.call("/api/channels/{0}/access_token".format(channel))
  File "/Library/Python/2.6/site-packages/livestreamer/plugins/twitch.py", line 39, in call
    res = urlget(url, params=params, session=self.session)
  File "/Library/Python/2.6/site-packages/livestreamer/utils.py", line 43, in urlget
    *args, **kw)
  File "/Library/Python/2.6/site-packages/livestreamer/utils.py", line 27, in urlopen
    res = session.request(method, url, timeout=timeout, *args, **kw)
  File "/Library/Python/2.6/site-packages/requests/sessions.py", line 361, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.6/site-packages/requests/sessions.py", line 464, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.6/site-packages/requests/adapters.py", line 321, in send
    timeout=timeout
  File "/Library/Python/2.6/site-packages/requests/packages/urllib3/connectionpool.py", line 471, in urlopen
    body=body, headers=headers)
  File "/Library/Python/2.6/site-packages/requests/packages/urllib3/connectionpool.py", line 285, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 874, in request
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 911, in _send_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 868, in endheaders
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 740, in _send_output
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 699, in send
  File "/Library/Python/2.6/site-packages/requests/packages/urllib3/connection.py", line 83, in connect
    if self._tunnel_host:
AttributeError: VerifiedHTTPSConnection instance has no attribute '_tunnel_host'

Downgrading fixes the issue just fine, but the latest version should be supported. At the very least, the requirements should be updated to only install a version earlier than 2.0.

@chrippa

This comment has been minimized.

Show comment
Hide comment
@chrippa

chrippa Nov 15, 2013

Owner

What version of requests 2.0 do you use exactly? I have tested it both with 2.0.0 and 2.0.1 and have not run into this issue.

Owner

chrippa commented Nov 15, 2013

What version of requests 2.0 do you use exactly? I have tested it both with 2.0.0 and 2.0.1 and have not run into this issue.

@fletom

This comment has been minimized.

Show comment
Hide comment
@fletom

fletom Nov 15, 2013

Sorry, I should have provided more information. This is requests 2.0.1.

I've done more testing. It actually works on my Mac OS 10.9 machine with Python 2.7.5 no problem.

On my Mac OS 10.6.8 machine with Python 2.6.1, I get the above traceback, and I have to downgrade to get it to work.

Let me know if you need more help debugging.

fletom commented Nov 15, 2013

Sorry, I should have provided more information. This is requests 2.0.1.

I've done more testing. It actually works on my Mac OS 10.9 machine with Python 2.7.5 no problem.

On my Mac OS 10.6.8 machine with Python 2.6.1, I get the above traceback, and I have to downgrade to get it to work.

Let me know if you need more help debugging.

@chrippa

This comment has been minimized.

Show comment
Hide comment
@chrippa

chrippa Nov 15, 2013

Owner

It looks like requests 2.0 uses an attribute that was not available until Python 2.6.3. I changed setup.py to force 1.x on those versions with 0ebafa7.

Owner

chrippa commented Nov 15, 2013

It looks like requests 2.0 uses an attribute that was not available until Python 2.6.3. I changed setup.py to force 1.x on those versions with 0ebafa7.

@chrippa chrippa closed this Nov 21, 2013

@fletom

This comment has been minimized.

Show comment
Hide comment
@fletom

fletom Dec 4, 2013

Hey, this works great. Thanks for the fix!

fletom commented Dec 4, 2013

Hey, this works great. Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment