@@ -59,29 +59,23 @@ def get_retweets(self, **params):
59
59
Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/retweets/%3Aid
60
60
61
61
"""
62
- if not 'id' in params :
63
- raise TwythonError ('Parameter "id" is required' )
64
- return self .get ('statuses/retweets/%s' % params ['id' ], params = params )
62
+ return self .get ('statuses/retweets/%s' % params .get ('id' ), params = params )
65
63
66
64
def show_status (self , ** params ):
67
65
"""Returns a single Tweet, specified by the id parameter
68
66
69
67
Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/show/%3Aid
70
68
71
69
"""
72
- if not 'id' in params :
73
- raise TwythonError ('Parameter "id" is required' )
74
- return self .get ('statuses/show/%s' % params ['id' ], params = params )
70
+ return self .get ('statuses/show/%s' % params .get ('id' ), params = params )
75
71
76
72
def destroy_status (self , ** params ):
77
73
"""Destroys the status specified by the required ID parameter
78
74
79
75
Docs: https://dev.twitter.com/docs/api/1.1/post/statuses/destroy/%3Aid
80
76
81
77
"""
82
- if not 'id' in params :
83
- raise TwythonError ('Parameter "id" is required' )
84
- return self .post ('statuses/destroy/%s' % params ['id' ])
78
+ return self .post ('statuses/destroy/%s' % params .get ('id' ))
85
79
86
80
def update_status (self , ** params ):
87
81
"""Updates the authenticating user's current status, also known as tweeting
@@ -97,9 +91,7 @@ def retweet(self, **params):
97
91
Docs: https://dev.twitter.com/docs/api/1.1/post/statuses/retweet/%3Aid
98
92
99
93
"""
100
- if not 'id' in params :
101
- raise TwythonError ('Parameter "id" is required' )
102
- return self .post ('statuses/retweet/%s' % params ['id' ])
94
+ return self .post ('statuses/retweet/%s' % params .get ('id' ))
103
95
104
96
def update_status_with_media (self , ** params ):
105
97
"""Updates the authenticating user's current status and attaches media
@@ -462,7 +454,7 @@ def get_user_suggestions_by_slug(self, **params):
462
454
Docs: https://dev.twitter.com/docs/api/1.1/get/users/suggestions/%3Aslug
463
455
464
456
"""
465
- return self .get ('users/suggestions/%s' % params [ 'slug' ] , params = params )
457
+ return self .get ('users/suggestions/%s' % params . get ( 'slug' ) , params = params )
466
458
467
459
def get_user_suggestions (self , ** params ):
468
460
"""Access to Twitter's suggested user list.
@@ -479,7 +471,7 @@ def get_user_suggestions_statuses_by_slug(self, **params):
479
471
Docs: https://dev.twitter.com/docs/api/1.1/get/users/suggestions/%3Aslug/members
480
472
481
473
"""
482
- return self .get ('users/suggestions/%s/members' % params [ 'slug' ] , params = params )
474
+ return self .get ('users/suggestions/%s/members' % params . get ( 'slug' ) , params = params )
483
475
484
476
# Favorites
485
477
def get_favorites (self , ** params ):
@@ -668,7 +660,7 @@ def show_saved_search(self, **params):
668
660
Docs: https://dev.twitter.com/docs/api/1.1/get/saved_searches/show/%3Aid
669
661
670
662
"""
671
- return self .get ('saved_searches/show/%s' % params [ 'id' ] , params = params )
663
+ return self .get ('saved_searches/show/%s' % params . get ( 'id' ) , params = params )
672
664
673
665
def create_saved_search (self , ** params ):
674
666
"""Create a new saved search for the authenticated user.
@@ -684,7 +676,7 @@ def destroy_saved_search(self, **params):
684
676
Docs: https://dev.twitter.com/docs/api/1.1/post/saved_searches/destroy/%3Aid
685
677
686
678
"""
687
- return self .post ('saved_searches/destroy/%s' % params [ 'id' ] , params = params )
679
+ return self .post ('saved_searches/destroy/%s' % params . get ( 'id' ) , params = params )
688
680
689
681
# Places & Geo
690
682
def get_geo_info (self , ** params ):
@@ -693,7 +685,7 @@ def get_geo_info(self, **params):
693
685
Docs: https://dev.twitter.com/docs/api/1.1/get/geo/id/%3Aplace_id
694
686
695
687
"""
696
- return self .get ('geo/id/%s' % params [ 'place_id' ] , params = params )
688
+ return self .get ('geo/id/%s' % params . get ( 'place_id' ) , params = params )
697
689
698
690
def reverse_geocode (self , ** params ):
699
691
"""Given a latitude and a longitude, searches for up to 20 places
0 commit comments