MCPcopy Create free account
hub / github.com/ryanmcgrath/twython / upload_media

Method upload_media

twython/endpoints.py:149–162  ·  view source on GitHub ↗

Uploads media file to Twitter servers. The file will be available to be attached to a status for 60 minutes. To attach to a update, pass a list of returned media ids to the :meth:`update_status` method using the ``media_ids`` param. Docs: https://developer.twitter.co

(self, **params)

Source from the content-addressed store, hash-verified

147 return self.post('statuses/update_with_media', params=params)
148
149 def upload_media(self, **params):
150 """Uploads media file to Twitter servers. The file will be available to be attached
151 to a status for 60 minutes. To attach to a update, pass a list of returned media ids
152 to the :meth:`update_status` method using the ``media_ids`` param.
153
154 Docs:
155 https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload
156
157 """
158 # https://developer.twitter.com/en/docs/media/upload-media/api-reference/get-media-upload-status
159 if params and params.get('command', '') == 'STATUS':
160 return self.get('https://upload.twitter.com/1.1/media/upload.json', params=params)
161
162 return self.post('https://upload.twitter.com/1.1/media/upload.json', params=params)
163
164 def create_metadata(self, **params):
165 """ Adds metadata to a media element, such as image descriptions for visually impaired.

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
postMethod · 0.80

Tested by

no test coverage detected