Add API.get_profile_banner
authorHarmon <Harmon758@gmail.com>
Fri, 9 Apr 2021 18:52:19 +0000 (13:52 -0500)
committerHarmon <Harmon758@gmail.com>
Fri, 9 Apr 2021 18:52:19 +0000 (13:52 -0500)
docs/api.rst
tweepy/api.py

index 495333e7ba10d229649fe7a84f2d14818e27ddd7..6faa86966026f8efe14dd2dd66a1ddbeda71ea41 100644 (file)
@@ -152,6 +152,8 @@ Manage account settings and profile
 
 .. automethod:: API.get_saved_search
 
+.. automethod:: API.get_profile_banner
+
 
 Direct Message Methods
 ----------------------
index 936d54999562fff379904e816e516d39d920a14f..3e495eba8b116a1ff22501ae0e9c8300e3f98e1d 100644 (file)
@@ -1804,6 +1804,30 @@ class API:
         """
         return self.request('GET', f'saved_searches/show/{id}', **kwargs)
 
+    @payload('json')
+    def get_profile_banner(self, **kwargs):
+        """get_profile_banner(*, user_id, screen_name)
+
+        Returns a map of the available size variations of the specified user's
+        profile banner. If the user has not uploaded a profile banner, a HTTP
+        404 will be served instead.
+
+        The profile banner data available at each size variant's URL is in PNG
+        format.
+
+        :param user_id: |user_id|
+        :param screen_name: |screen_name|
+
+        :rtype: :class:`JSON` object
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-users-profile_banner
+        """
+        return self.request(
+            'GET', 'users/profile_banner', endpoint_parameters=(
+                'user_id', 'screen_name'
+            ), **kwargs
+        )
+
     def media_upload(self, filename, *, file=None, chunked=False,
                      media_category=None, additional_owners=None, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/overview