11#!/usr/bin/env python
22
33#
4- # vim: sw=2 ts=2 sts=2
54#
65# Copyright 2007 The Python-Twitter Developers
76#
@@ -107,15 +106,15 @@ class Api(object):
107106 >>> api.GetReplies()
108107 >>> api.GetUserTimeline(user)
109108 >>> api.GetHomeTimeline()
110- >>> api.GetStatus(id )
111- >>> api.DestroyStatus(id )
109+ >>> api.GetStatus(status_id )
110+ >>> api.DestroyStatus(status_id )
112111 >>> api.GetFriends(user)
113112 >>> api.GetFollowers()
114113 >>> api.GetFeatured()
115114 >>> api.GetDirectMessages()
116115 >>> api.GetSentDirectMessages()
117116 >>> api.PostDirectMessage(user, text)
118- >>> api.DestroyDirectMessage(id )
117+ >>> api.DestroyDirectMessage(message_id )
119118 >>> api.DestroyFriendship(user)
120119 >>> api.CreateFriendship(user)
121120 >>> api.LookupFriendship(user)
@@ -490,9 +489,9 @@ def GetTrendsCurrent(self, exclude=None):
490489 Returns:
491490 A list with 10 entries. Each entry contains a trend.
492491 """
493- return self .GetTrendsWoeid (id = 1 , exclude = exclude )
492+ return self .GetTrendsWoeid (woeid = 1 , exclude = exclude )
494493
495- def GetTrendsWoeid (self , id , exclude = None ):
494+ def GetTrendsWoeid (self , woeid , exclude = None ):
496495 """Return the top 10 trending topics for a specific WOEID, if trending
497496 information is available for it.
498497
@@ -507,7 +506,7 @@ def GetTrendsWoeid(self, id, exclude=None):
507506 A list with 10 entries. Each entry contains a trend.
508507 """
509508 url = '%s/trends/place.json' % (self .base_url )
510- parameters = {'id' : id }
509+ parameters = {'id' : woeid }
511510
512511 if exclude :
513512 parameters ['exclude' ] = exclude
@@ -723,14 +722,14 @@ def GetUserTimeline(self,
723722 return [Status .NewFromJsonDict (x ) for x in data ]
724723
725724 def GetStatus (self ,
726- id ,
725+ status_id ,
727726 trim_user = False ,
728727 include_my_retweet = True ,
729728 include_entities = True ):
730- """Returns a single status message, specified by the id parameter.
729+ """Returns a single status message, specified by the status_id parameter.
731730
732731 Args:
733- id :
732+ status_id :
734733 The numeric ID of the status you are trying to retrieve.
735734 trim_user:
736735 When set to True, each tweet returned in a timeline will include
@@ -754,9 +753,9 @@ def GetStatus(self,
754753 parameters = {}
755754
756755 try :
757- parameters ['id' ] = int (id )
756+ parameters ['id' ] = int (status_id )
758757 except ValueError :
759- raise TwitterError ({'message' : "'id ' must be an integer." })
758+ raise TwitterError ({'message' : "'status_id ' must be an integer." })
760759
761760 if trim_user :
762761 parameters ['trim_user' ] = 1
@@ -771,7 +770,7 @@ def GetStatus(self,
771770 return Status .NewFromJsonDict (data )
772771
773772 def GetStatusOembed (self ,
774- id = None ,
773+ status_id = None ,
775774 url = None ,
776775 maxwidth = None ,
777776 hide_media = False ,
@@ -786,7 +785,7 @@ def GetStatusOembed(self,
786785 Specify tweet by the id or url parameter.
787786
788787 Args:
789- id :
788+ status_id :
790789 The numeric ID of the status you are trying to embed.
791790 url:
792791 The url of the status you are trying to embed.
@@ -816,15 +815,15 @@ def GetStatusOembed(self,
816815
817816 parameters = {}
818817
819- if id is not None :
818+ if status_id is not None :
820819 try :
821- parameters ['id' ] = int (id )
820+ parameters ['id' ] = int (status_id )
822821 except ValueError :
823- raise TwitterError ({'message' : "'id ' must be an integer." })
822+ raise TwitterError ({'message' : "'status_id ' must be an integer." })
824823 elif url is not None :
825824 parameters ['url' ] = url
826825 else :
827- raise TwitterError ({'message' : "Must specify either 'id ' or 'url'" })
826+ raise TwitterError ({'message' : "Must specify either 'status_id ' or 'url'" })
828827
829828 if maxwidth is not None :
830829 parameters ['maxwidth' ] = maxwidth
@@ -852,24 +851,24 @@ def GetStatusOembed(self,
852851
853852 return data
854853
855- def DestroyStatus (self , id , trim_user = False ):
854+ def DestroyStatus (self , status_id , trim_user = False ):
856855 """Destroys the status specified by the required ID parameter.
857856
858857 The authenticating user must be the author of the specified
859858 status.
860859
861860 Args:
862- id :
861+ status_id :
863862 The numerical ID of the status you're trying to destroy.
864863
865864 Returns:
866865 A twitter.Status instance representing the destroyed status message
867866 """
868867 try :
869- post_data = {'id' : int (id )}
868+ post_data = {'id' : int (status_id )}
870869 except ValueError :
871- raise TwitterError ({'message' : "id must be an integer" })
872- url = '%s/statuses/destroy/%s.json' % (self .base_url , id )
870+ raise TwitterError ({'message' : "status_id must be an integer" })
871+ url = '%s/statuses/destroy/%s.json' % (self .base_url , status_id )
873872 if trim_user :
874873 post_data ['trim_user' ] = 1
875874
@@ -1406,11 +1405,11 @@ def PostUpdates(self,
14061405
14071406 return results
14081407
1409- def PostRetweet (self , original_id , trim_user = False ):
1408+ def PostRetweet (self , status_id , trim_user = False ):
14101409 """Retweet a tweet with the Retweet API.
14111410
14121411 Args:
1413- original_id :
1412+ status_id :
14141413 The numerical id of the tweet that will be retweeted
14151414 trim_user:
14161415 If True the returned payload will only contain the user IDs,
@@ -1421,13 +1420,13 @@ def PostRetweet(self, original_id, trim_user=False):
14211420 A twitter.Status instance representing the original tweet with retweet details embedded.
14221421 """
14231422 try :
1424- if int (original_id ) <= 0 :
1425- raise TwitterError ({'message' : "'original_id ' must be a positive number" })
1423+ if int (status_id ) <= 0 :
1424+ raise TwitterError ({'message' : "'status_id ' must be a positive number" })
14261425 except ValueError :
1427- raise TwitterError ({'message' : "'original_id ' must be an integer" })
1426+ raise TwitterError ({'message' : "'status_id ' must be an integer" })
14281427
1429- url = '%s/statuses/retweet/%s.json' % (self .base_url , original_id )
1430- data = {'id' : original_id }
1428+ url = '%s/statuses/retweet/%s.json' % (self .base_url , status_id )
1429+ data = {'id' : status_id }
14311430 if trim_user :
14321431 data ['trim_user' ] = 'true'
14331432 resp = self ._RequestUrl (url , 'POST' , data = data )
@@ -1771,24 +1770,24 @@ def GetBlocksIDs(self,
17711770
17721771 return result
17731772
1774- def DestroyBlock (self , id , trim_user = False ):
1773+ def DestroyBlock (self , user_id , trim_user = False ):
17751774 """Destroys the block for the user specified by the required ID
17761775 parameter.
17771776
17781777 The authenticating user must have blocked the user specified by the
17791778 required ID parameter.
17801779
17811780 Args:
1782- id :
1781+ user_id :
17831782 The numerical ID of the user to be un-blocked.
17841783
17851784 Returns:
17861785 A twitter.User instance representing the un-blocked user.
17871786 """
17881787 try :
1789- post_data = {'user_id' : int (id )}
1788+ post_data = {'user_id' : int (user_id )}
17901789 except ValueError :
1791- raise TwitterError ({'message' : "id must be an integer" })
1790+ raise TwitterError ({'message' : "user_id must be an integer" })
17921791 url = '%s/blocks/destroy.json' % (self .base_url )
17931792 if trim_user :
17941793 post_data ['trim_user' ] = 1
@@ -2640,21 +2639,21 @@ def PostDirectMessage(self,
26402639
26412640 return DirectMessage .NewFromJsonDict (data )
26422641
2643- def DestroyDirectMessage (self , id , include_entities = True ):
2642+ def DestroyDirectMessage (self , message_id , include_entities = True ):
26442643 """Destroys the direct message specified in the required ID parameter.
26452644
26462645 The twitter.Api instance must be authenticated, and the
26472646 authenticating user must be the recipient of the specified direct
26482647 message.
26492648
26502649 Args:
2651- id : The id of the direct message to be destroyed
2650+ message_id : The id of the direct message to be destroyed
26522651
26532652 Returns:
26542653 A twitter.DirectMessage instance representing the message destroyed
26552654 """
26562655 url = '%s/direct_messages/destroy.json' % self .base_url
2657- data = {'id' : id }
2656+ data = {'id' : message_id }
26582657 if not include_entities :
26592658 data ['include_entities' ] = 'false'
26602659
@@ -2810,14 +2809,14 @@ def LookupFriendship(self,
28102809
28112810 def CreateFavorite (self ,
28122811 status = None ,
2813- id = None ,
2812+ status_id = None ,
28142813 include_entities = True ):
28152814 """Favorites the specified status object or id as the authenticating user.
28162815
28172816 Returns the favorite status when successful.
28182817
28192818 Args:
2820- id :
2819+ status_id :
28212820 The id of the twitter status to mark as a favorite. [Optional]
28222821 status:
28232822 The twitter.Status object to mark as a favorite. [Optional]
@@ -2829,12 +2828,12 @@ def CreateFavorite(self,
28292828 """
28302829 url = '%s/favorites/create.json' % self .base_url
28312830 data = {}
2832- if id :
2833- data ['id' ] = id
2831+ if status_id :
2832+ data ['id' ] = status_id
28342833 elif status :
28352834 data ['id' ] = status .id
28362835 else :
2837- raise TwitterError ({'message' : "Specify id or status" })
2836+ raise TwitterError ({'message' : "Specify status_id or status" })
28382837 if not include_entities :
28392838 data ['include_entities' ] = 'false'
28402839
@@ -2845,14 +2844,14 @@ def CreateFavorite(self,
28452844
28462845 def DestroyFavorite (self ,
28472846 status = None ,
2848- id = None ,
2847+ status_id = None ,
28492848 include_entities = True ):
28502849 """Un-Favorites the specified status object or id as the authenticating user.
28512850
28522851 Returns the un-favorited status when successful.
28532852
28542853 Args:
2855- id :
2854+ status_id :
28562855 The id of the twitter status to unmark as a favorite. [Optional]
28572856 status:
28582857 The twitter.Status object to unmark as a favorite. [Optional]
@@ -2864,12 +2863,12 @@ def DestroyFavorite(self,
28642863 """
28652864 url = '%s/favorites/destroy.json' % self .base_url
28662865 data = {}
2867- if id :
2868- data ['id' ] = id
2866+ if status_id :
2867+ data ['id' ] = status_id
28692868 elif status :
28702869 data ['id' ] = status .id
28712870 else :
2872- raise TwitterError ({'message' : "Specify id or status" })
2871+ raise TwitterError ({'message' : "Specify status_id or status" })
28732872 if not include_entities :
28742873 data ['include_entities' ] = 'false'
28752874
0 commit comments