Skip to content

Commit 57fdab1

Browse files
committed
Fixed v1.1 POST bug
1 parent bcc76a3 commit 57fdab1

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

CHANGE.log

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,5 @@ v2.7.8, 29 Nov 2021 -- Fixed hydrated media keys
192192

193193
v2.7.9, 30 Nov 2021 -- Specify all supported endpoint methods in constants.py
194194
Added new v2 endpoints
195+
196+
v2.7.10, 14 Dec 2021 -- Fixed v1.1 POST bug

TwitterAPI/TwitterAPI.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,17 @@ def request(self, resource, params=None, files=None, method_override=None, hydra
172172
else:
173173
raise Exception(f'Endpoint "{endpoint}" with method "{method_override}" unsupported')
174174

175-
if not params:
176-
params = {}
177-
if self.version == '1.1':
178-
# used only for streaming
179-
params['delimited'] = 'length'
180-
params['stall_warnings'] = 'true'
181-
182175
with requests.Session() as session:
183176
session.auth = self.auth
184177
session.headers = {'User-Agent': self.USER_AGENT}
185178
url = self._prepare_url(subdomain, resource)
186179
if self.version == '1.1' and 'stream' in subdomain:
187180
session.stream = True
188181
timeout = self.STREAMING_TIMEOUT
182+
if not params:
183+
params = {}
184+
params['delimited'] = 'length'
185+
params['stall_warnings'] = 'true'
189186
elif self.version == '2' and resource.endswith('/stream'):
190187
session.stream = True
191188
timeout = self.STREAMING_TIMEOUT

TwitterAPI/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = 'TwitterAPI'
2-
__version__ = '2.7.9.1'
2+
__version__ = '2.7.10'
33
__author__ = 'geduldig'
44
__license__ = 'MIT'
55
__copyright__ = 'Copyright 2013 geduldig'

0 commit comments

Comments
 (0)