jimsafley/omeka-client-py — pull request #3 by wcaleb (2013-10-18 03:23:28+00:00)
Title: Added a function for posting files to Omeka API

This is a first take at adding a function to the OmekaClient that can POST to the Omeka API using the "files/" resource. Given a filename and file contents, the function encodes the multipart/form-data request and passes it along to the original post function.

To make it work I had to change the post function slightly so that headers could be passed to it, and I also import mimetypes and use a function to figure out the file type from the file name. Apologies for any unpythonic ugliness. I'm still a Python newbie, but in my initial tests of this function, it seems to work pretty well.

Some of the earlier commit messages refer to a test script that I later deleted from this branch.