Created
March 9, 2015 01:26
-
-
Save dmora/03391e00a327396eca97 to your computer and use it in GitHub Desktop.
Upload local file with python to filepicker using their REST API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from poster.encode import multipart_encode | |
from poster.streaminghttp import register_openers | |
import urllib2 | |
register_openers() | |
datagen, headers = multipart_encode({"fileUpload": open("filaname.jpg")}) | |
request = urllib2.Request("https://www.filepicker.io/api/store/S3?key={yourKey}", \ | |
datagen, headers) | |
response = urllib2.urlopen(request) | |
print urllib2.urlopen(request).read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment