Merge pull request #147 from U2Ft/requests-1.1.0

Updated for requests 1.1.0
This commit is contained in:
Ryan McGrath 2013-02-15 08:15:35 -08:00
commit d5c628f3b5
2 changed files with 8 additions and 5 deletions

View file

@ -14,7 +14,7 @@ setup(
include_package_data=True,
# 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.
author='Ryan McGrath',

View file

@ -14,7 +14,7 @@ import re
import warnings
import requests
from requests.auth import OAuth1
from requests_oauthlib import OAuth1
try:
from urlparse import parse_qsl
@ -115,7 +115,8 @@ class Twython(object):
self.headers = headers or {'User-Agent': 'Twython v' + __version__}
# Allow for unauthenticated requests
self.client = requests.session(proxies=proxies)
self.client = requests.Session()
self.client.proxies = proxies
self.auth = None
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')
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.
def setFunc(key):
@ -181,7 +185,6 @@ class Twython(object):
'api_call': api_call,
'api_error': None,
'cookies': response.cookies,
'error': response.error,
'headers': response.headers,
'status_code': response.status_code,
'url': response.url,