Update API.destroy_direct_message
authorHarmon <Harmon758@gmail.com>
Fri, 21 Jun 2019 05:05:33 +0000 (00:05 -0500)
committerHarmon <Harmon758@gmail.com>
Fri, 21 Jun 2019 16:59:33 +0000 (11:59 -0500)
docs/api.rst
tweepy/api.py
tweepy/binder.py

index 7ebaccc0d5919534d13535624864974589c7776f..260cbd3170fb6c806467392771f361b814099bfc 100644 (file)
@@ -287,11 +287,13 @@ Direct Message Methods
 
 .. method:: API.destroy_direct_message(id)
 
-   Destroy a direct message. Authenticating user must be the recipient of
-   the direct message.
+   Deletes the direct message specified in the required ID parameter.
+   The authenticating user must be the recipient of the specified direct message.
+   Direct Messages are only removed from the interface of the user context provided.
+   Other members of the conversation can still access the Direct Messages.
 
-   :param id: The ID of the direct message to destroy.
-   :rtype: :class:`DirectMessage` object
+   :param id: The id of the Direct Message that should be deleted.
+   :rtype: None
 
 
 Friendship Methods
index cc2e3bde893cf6cd4856d401963b4a8415eb9620..49f2f3629dffbedb62dd2892817b3ce2b093a4e1 100644 (file)
@@ -459,14 +459,13 @@ class API(object):
 
     @property
     def destroy_direct_message(self):
-        """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message
+        """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event
             :allowed_param:'id'
         """
         return bind_api(
             api=self,
-            path='/direct_messages/destroy.json',
-            method='POST',
-            payload_type='direct_message',
+            path='/direct_messages/events/destroy.json',
+            method='DELETE',
             allowed_param=['id'],
             require_auth=True
         )
index 20f961ce507dc1f51b788903e980756f5b505dbf..60b6b70fd734e2be3719799271da9bb129007ffe 100644 (file)
@@ -205,7 +205,7 @@ def bind_api(**config):
                     continue
                 retry_delay = self.retry_delay
                 # Exit request loop if non-retry error code
-                if resp.status_code == 200:
+                if resp.status_code in (200, 204):
                     break
                 elif (resp.status_code == 429 or resp.status_code == 420) and self.wait_on_rate_limit:
                     if 'retry-after' in resp.headers: