Commit d2419625 authored by Aaron Hill's avatar Aaron Hill
Browse files

Merge pull request #364 from vmeyet/update-status-with-media

Add statuses/update_with_media feature
parents 06614606 3b57055f
...@@ -70,6 +70,10 @@ class TweepyAPITests(TweepyTestCase): ...@@ -70,6 +70,10 @@ class TweepyAPITests(TweepyTestCase):
deleted = self.api.destroy_status(id=update.id) deleted = self.api.destroy_status(id=update.id)
self.assertEqual(deleted.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): def testgetuser(self):
u = self.api.get_user('twitter') u = self.api.get_user('twitter')
self.assertEqual(u.screen_name, 'twitter') self.assertEqual(u.screen_name, 'twitter')
......
...@@ -89,6 +89,22 @@ class API(object): ...@@ -89,6 +89,22 @@ class API(object):
require_auth = True 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 """ """ statuses/destroy """
destroy_status = bind_api( destroy_status = bind_api(
path = '/statuses/destroy/{id}.json', 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