Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
3b57055f
Commit
3b57055f
authored
Nov 21, 2013
by
Vivien Meyet
Committed by
Aaron Hill
Dec 21, 2013
Browse files
update-status-with-media add update with media feature
parent
06614606
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/test_api.py
View file @
3b57055f
...
...
@@ -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'
)
...
...
tweepy/api.py
View file @
3b57055f
...
...
@@ -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'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment