Skip to content

Commit d019189

Browse files
Copy of client args, and restrict travis to only master (still build for PR though)
I'm dumb.
1 parent 1dfa11d commit d019189

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ script: nosetests -v test_twython:TwythonAPITestCase test_twython:TwythonAuthTes
3030
install: pip install -r requirements.txt
3131
notifications:
3232
email: false
33+
branches:
34+
only:
35+
- master
3336
after_success:
3437
- coverage run --source=twython setup.py -q nosetests
3538
- coveralls

twython/api.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,14 @@ def __init__(self, app_key=None, app_secret=None, oauth_token=None,
9696
self.client = requests.Session()
9797
self.client.auth = auth
9898

99-
for k, v in self.client_args:
99+
# Make a copy of the client args and iterate over them
100+
# Pop out all the acceptable args at this point because they will
101+
# Never be used again.
102+
client_args_copy = self.client_args.copy()
103+
for k, v in client_args_copy.items():
100104
if k in ('cert', 'headers', 'hooks', 'max_redirects', 'proxies'):
101105
setattr(self.client, k, v)
102-
client_args.pop(k)
106+
self.client_args.pop(k) # Pop, pop!
103107

104108
self._last_call = None
105109

@@ -115,10 +119,10 @@ def _request(self, url, method='GET', params=None, api_call=None):
115119
params, files = _transparent_params(params)
116120

117121
requests_args = {}
118-
for k, v in self.client_args:
122+
for k, v in self.client_args.items():
123+
# Maybe this should be set as a class variable and only done once?
119124
if k in ('timeout', 'allow_redirects', 'stream', 'verify'):
120125
requests_args[k] = v
121-
self.client_args.pop(k)
122126

123127
if method == 'get':
124128
requests_args['params'] = params

0 commit comments

Comments
 (0)