Copy of client args, and restrict travis to only master (still build for PR though)

I'm dumb.
This commit is contained in:
Mike Helmick 2013-06-11 10:18:25 -04:00
parent 1dfa11dd27
commit d0191895d5
2 changed files with 11 additions and 4 deletions

View file

@ -30,6 +30,9 @@ script: nosetests -v test_twython:TwythonAPITestCase test_twython:TwythonAuthTes
install: pip install -r requirements.txt install: pip install -r requirements.txt
notifications: notifications:
email: false email: false
branches:
only:
- master
after_success: after_success:
- coverage run --source=twython setup.py -q nosetests - coverage run --source=twython setup.py -q nosetests
- coveralls - coveralls

View file

@ -96,10 +96,14 @@ class Twython(EndpointsMixin, object):
self.client = requests.Session() self.client = requests.Session()
self.client.auth = auth self.client.auth = auth
for k, v in self.client_args: # Make a copy of the client args and iterate over them
# Pop out all the acceptable args at this point because they will
# Never be used again.
client_args_copy = self.client_args.copy()
for k, v in client_args_copy.items():
if k in ('cert', 'headers', 'hooks', 'max_redirects', 'proxies'): if k in ('cert', 'headers', 'hooks', 'max_redirects', 'proxies'):
setattr(self.client, k, v) setattr(self.client, k, v)
client_args.pop(k) self.client_args.pop(k) # Pop, pop!
self._last_call = None self._last_call = None
@ -115,10 +119,10 @@ class Twython(EndpointsMixin, object):
params, files = _transparent_params(params) params, files = _transparent_params(params)
requests_args = {} requests_args = {}
for k, v in self.client_args: for k, v in self.client_args.items():
# Maybe this should be set as a class variable and only done once?
if k in ('timeout', 'allow_redirects', 'stream', 'verify'): if k in ('timeout', 'allow_redirects', 'stream', 'verify'):
requests_args[k] = v requests_args[k] = v
self.client_args.pop(k)
if method == 'get': if method == 'get':
requests_args['params'] = params requests_args['params'] = params