Commit 3b57055f authored by Vivien Meyet's avatar Vivien Meyet Committed by Aaron Hill
Browse files

update-status-with-media add update with media feature

parent 06614606
......@@ -70,6 +70,10 @@ class TweepyAPITests(TweepyTestCase):
deleted = self.api.destroy_status(id=update.id)
self.assertEqual(deleted.id, update.id)
def testupdatestatuswithmedia(self):
update = self.api.update_with_media('examples/banner.png', status=tweet_text)
self.assertEqual(update.text, tweet_text)
def testgetuser(self):
u = self.api.get_user('twitter')
self.assertEqual(u.screen_name, 'twitter')
......
......@@ -89,6 +89,22 @@ class API(object):
require_auth = True
)
""" statuses/update_with_media """
def update_with_media(self, filename, *args, **kwargs):
headers, post_data = API._pack_image(filename, 3072, form_field='media[]')
kwargs.update({'headers': headers, 'post_data': post_data})
return bind_api(
path='/statuses/update_with_media.json',
method = 'POST',
payload_type='status',
allowed_param = [
'status', 'possibly_sensitive', 'in_reply_to_status_id', 'lat', 'long',
'place_id', 'display_coordinates'
],
require_auth=True
)(self, *args, **kwargs)
""" statuses/destroy """
destroy_status = bind_api(
path = '/statuses/destroy/{id}.json',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment