Document API.update_profile_banner
authorHarmon <Harmon758@gmail.com>
Sat, 10 Apr 2021 14:22:17 +0000 (09:22 -0500)
committerHarmon <Harmon758@gmail.com>
Sat, 10 Apr 2021 14:29:52 +0000 (09:29 -0500)
Automatically use docstring for documentation
Improve method order

docs/api.rst
tweepy/api.py

index 336f0879a61518fcdf492ce88e90d01476e38d1d..2419d07356bb51451b74b5668cfbd62f8ef72857 100644 (file)
@@ -160,6 +160,8 @@ Manage account settings and profile
 
 .. automethod:: API.update_profile
 
+.. automethod:: API.update_profile_banner
+
 
 Direct Message Methods
 ----------------------
index 9d04926dad41ffb837c32957a57682d8fb9a5b43..91b36c22cc2ab94fd47e0e7a2bb68dfacc602001 100644 (file)
@@ -1912,6 +1912,39 @@ class API:
             ), **kwargs
         )
 
+    def update_profile_banner(self, filename, *, file=None, **kwargs):
+        """update_profile_banner(filename, *, file, width, height, \
+                                 offset_left, offset_top)
+
+        Uploads a profile banner on behalf of the authenticating user.
+
+        :param filename: |filename|
+        :param file: |file|
+        :param width: The width of the preferred section of the image being
+            uploaded in pixels. Use with ``height``, ``offset_left``, and
+            ``offset_top`` to select the desired region of the image to use.
+        :param height: The height of the preferred section of the image being
+            uploaded in pixels. Use with ``width``, ``offset_left``, and
+            ``offset_top`` to select the desired region of the image to use.
+        :param offset_left: The number of pixels by which to offset the
+            uploaded image from the left. Use with ``height``, ``width``, and
+            ``offset_top`` to select the desired region of the image to use.
+        :param offset_top: The number of pixels by which to offset the uploaded
+            image from the top. Use with ``height``, ``width``, and
+            ``offset_left`` to select the desired region of the image to use.
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner
+        """
+        if file is not None:
+            files = {'banner': (filename, file)}
+        else:
+            files = {'banner': open(filename, 'rb')}
+        return self.request(
+            'POST', 'account/update_profile_banner', endpoint_parameters=(
+                'width', 'height', 'offset_left', 'offset_right'
+            ), files=files, **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
@@ -2165,19 +2198,6 @@ class API:
             ), files=files, **kwargs
         )
 
-    def update_profile_banner(self, filename, *, file=None, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner
-        """
-        if file is not None:
-            files = {'banner': (filename, file)}
-        else:
-            files = {'banner': open(filename, 'rb')}
-        return self.request(
-            'POST', 'account/update_profile_banner', endpoint_parameters=(
-                'width', 'height', 'offset_left', 'offset_right'
-            ), files=files, **kwargs
-        )
-
     @payload('user')
     def create_block(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create