diff --git a/twitter/api.py b/twitter/api.py index b1268bcf..7c422cdb 100755 --- a/twitter/api.py +++ b/twitter/api.py @@ -2909,8 +2909,7 @@ def GetUser(self, return User.NewFromJsonDict(data) def GetDirectMessages(self, - since_id=None, - max_id=None, + cursor=None, count=None, include_entities=True, skip_status=False, @@ -2920,53 +2919,27 @@ def GetDirectMessages(self, """Returns a list of the direct messages sent to the authenticating user. Args: - since_id: - Returns results with an ID greater than (that is, more recent - than) the specified ID. There are limits to the number of - Tweets which can be accessed through the API. If the limit of - Tweets has occurred since the since_id, the since_id will be - forced to the oldest ID available. [Optional] - max_id: - Returns results with an ID less than (that is, older than) or - equal to the specified ID. [Optional] + cursor: + For paging through result sets greater than 1 page, use the + “next_cursor” property from the previous request. [Optional] count: Specifies the number of direct messages to try and retrieve, up to a maximum of 200. The value of count is best thought of as a limit to the number of Tweets to return because suspended or deleted content is removed after the count has been applied. [Optional] - include_entities: - The entities node will be omitted when set to False. - [Optional] - skip_status: - When set to True statuses will not be included in the returned user - objects. [Optional] - full_text: - When set to True full message will be included in the returned message - object if message length is bigger than CHARACTER_LIMIT characters. [Optional] - page: - If you want more than 200 messages, you can use this and get 20 messages - each time. You must recall it and increment the page value until it - return nothing. You can't use count option with it. First value is 1 and - not 0. return_json (bool, optional): If True JSON data will be returned, instead of twitter.User Returns: A sequence of twitter.DirectMessage instances """ - url = '%s/direct_messages.json' % self.base_url + url = '%s/direct_messages/events/list.json' % self.base_url parameters = { - 'full_text': bool(full_text), - 'include_entities': bool(include_entities), - 'max_id': max_id, - 'since_id': since_id, - 'skip_status': bool(skip_status), + 'cursor': cursor } if count: parameters['count'] = enf_type('count', int, count) - if page: - parameters['page'] = enf_type('page', int, page) resp = self._RequestUrl(url, 'GET', data=parameters) data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))