Added support for the new direct message endpoints #500

Merged
manuelcortez merged 5 commits from master into master 2019-04-10 07:01:10 -07:00
Showing only changes of commit a8a0777f72 - Show all commits

View file

@ -153,7 +153,7 @@ class Twython(EndpointsMixin, object):
if k in ('timeout', 'allow_redirects', 'stream', 'verify'):
anapaulagomes commented 2018-09-30 07:09:40 -07:00 (Migrated from github.com)

Seems single quotes are part of the project code style. 🤔

Seems single quotes are part of the project code style. :thinking:
requests_args[k] = v
if method == 'get':
if method == 'get' or method == 'delete':
requests_args['params'] = params
else:
# Check for json_encoded so we will sent params as "data" or "json"
@ -242,7 +242,7 @@ class Twython(EndpointsMixin, object):
(e.g. search/tweets)
:type endpoint: string
:param method: (optional) Method of accessing data, either
GET or POST. (default GET)
GET, POST or DELETE. (default GET)
:type method: string
:param params: (optional) Dict of parameters (if any) accepted
the by Twitter API endpoint you are trying to
@ -281,6 +281,10 @@ class Twython(EndpointsMixin, object):
"""Shortcut for POST requests via :class:`request`"""
return self.request(endpoint, 'POST', params=params, version=version, json_encoded=json_encoded)
def delete(self, endpoint, params=None, version='1.1', json_encoded=False):
"""Shortcut for delete requests via :class:`request`"""
return self.request(endpoint, 'DELETE', params=params, version=version, json_encoded=json_encoded)
def get_lastfunction_header(self, header, default_return_value=None):
"""Returns a specific header from the last API call
This will return None if the header is not present