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
1928fe36
Commit
1928fe36
authored
Jun 09, 2013
by
Aaron Hill
Browse files
Added optional parameter form_field to _pack_image
parent
d50ce7d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
tweepy/api.py
View file @
1928fe36
...
...
@@ -690,7 +690,7 @@ class API(object):
""" Internal use only """
@
staticmethod
def
_pack_image
(
filename
,
max_size
):
def
_pack_image
(
filename
,
max_size
,
form_field
=
"image"
):
"""Pack image from file into multipart-formdata post body"""
# image must be less than 700kb in size
try
:
...
...
@@ -712,7 +712,7 @@ class API(object):
BOUNDARY
=
'Tw3ePy'
body
=
[]
body
.
append
(
'--'
+
BOUNDARY
)
body
.
append
(
'Content-Disposition: form-data; name="
image
"; filename="%s"'
%
filename
)
body
.
append
(
'Content-Disposition: form-data; name="
%s
"; filename="%s"'
%
(
form_field
,
filename
)
)
body
.
append
(
'Content-Type: %s'
%
file_type
)
body
.
append
(
''
)
body
.
append
(
fp
.
read
())
...
...
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