From d0191895d581d14738995013b64dbe531d07781c Mon Sep 17 00:00:00 2001 From: Mike Helmick Date: Tue, 11 Jun 2013 10:18:25 -0400 Subject: [PATCH] Copy of client args, and restrict travis to only master (still build for PR though) I'm dumb. --- .travis.yml | 3 +++ twython/api.py | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78d8c22..a8394c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,9 @@ script: nosetests -v test_twython:TwythonAPITestCase test_twython:TwythonAuthTes install: pip install -r requirements.txt notifications: email: false +branches: + only: + - master after_success: - coverage run --source=twython setup.py -q nosetests - coveralls diff --git a/twython/api.py b/twython/api.py index 34f1432..7a0eb38 100644 --- a/twython/api.py +++ b/twython/api.py @@ -96,10 +96,14 @@ class Twython(EndpointsMixin, object): self.client = requests.Session() 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'): setattr(self.client, k, v) - client_args.pop(k) + self.client_args.pop(k) # Pop, pop! self._last_call = None @@ -115,10 +119,10 @@ class Twython(EndpointsMixin, object): params, files = _transparent_params(params) 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'): requests_args[k] = v - self.client_args.pop(k) if method == 'get': requests_args['params'] = params