This commit is contained in:
Sam Mellor 2013-02-07 03:27:15 -08:00
commit a10eba9f4a
2 changed files with 8 additions and 5 deletions

View file

@ -14,7 +14,7 @@ setup(
include_package_data=True, include_package_data=True,
# Package dependencies. # Package dependencies.
install_requires=['simplejson', 'requests==0.14.0'], install_requires=['simplejson', 'requests>=1.0.0, <2.0.0', 'requests_oauthlib==0.3.0'],
# Metadata for PyPI. # Metadata for PyPI.
author='Ryan McGrath', author='Ryan McGrath',

View file

@ -14,7 +14,7 @@ import re
import warnings import warnings
import requests import requests
from requests.auth import OAuth1 from requests_oauthlib import OAuth1
try: try:
from urlparse import parse_qsl from urlparse import parse_qsl
@ -115,7 +115,8 @@ class Twython(object):
self.headers = headers or {'User-Agent': 'Twython v' + __version__} self.headers = headers or {'User-Agent': 'Twython v' + __version__}
# Allow for unauthenticated requests # Allow for unauthenticated requests
self.client = requests.session(proxies=proxies) self.client = requests.Session()
self.client.proxies = proxies
self.auth = None self.auth = None
if self.app_key is not None and self.app_secret is not None and \ if self.app_key is not None and self.app_secret is not None and \
@ -130,7 +131,10 @@ class Twython(object):
signature_type='auth_header') signature_type='auth_header')
if self.auth is not None: if self.auth is not None:
self.client = requests.session(headers=self.headers, auth=self.auth, proxies=proxies) self.client = requests.Session()
self.client.headers = self.headers
self.client.auth = self.auth
self.client.proxies = proxies
# register available funcs to allow listing name when debugging. # register available funcs to allow listing name when debugging.
def setFunc(key): def setFunc(key):
@ -181,7 +185,6 @@ class Twython(object):
'api_call': api_call, 'api_call': api_call,
'api_error': None, 'api_error': None,
'cookies': response.cookies, 'cookies': response.cookies,
'error': response.error,
'headers': response.headers, 'headers': response.headers,
'status_code': response.status_code, 'status_code': response.status_code,
'url': response.url, 'url': response.url,