Add multipart form support. Does not yet handle additional post parameters correctly.

This commit is contained in:
sneakypete81 2013-03-17 15:08:09 +00:00
parent 0ef3abe79e
commit 5858043d44
3 changed files with 43 additions and 5 deletions

View file

@ -67,7 +67,9 @@ class ApiPhoto:
return photo
def upload(self, photo_file, **kwds):
raise NotImplementedError("Use upload_encoded instead.")
result = self._client.post("/photo/upload.json", files={'photo': photo_file},
**kwds)["result"]
return Photo(self._client, result)
def upload_encoded(self, photo_file, **kwds):
""" Base64-encodes and uploads the specified file """