urschrei / pyzotero

Pyzotero: a Python client for the Zotero API
https://pyzotero.readthedocs.org
Other
911 stars 100 forks source link

New functionality - file method to allow pulling raw file content from Zotero #37

Closed mpaolino closed 9 years ago

mpaolino commented 10 years ago

This PR incorporates the "file" method to pyzotero that will pull the raw content of the file and return it as a binary string. This also includes the corresponding test and documentation update.

There is a limitation on the type of files that will be returned as raw content, as given by:

        self.file_content_types = ['application/msword'                          
                                   'application/pdf',                            
                                   'application/octet-stream',                   
                                   'application/x-tex',                          
                                   'application/x-texinfo',                      
                                   'image/jpeg',                                 
                                   'image/png',                                  
                                   'image/gif',                                  
                                   'image/tiff',                                 
                                   'application/postscript',                     
                                   'application/rtf']                            

Related Zotero API documentation:

https://www.zotero.org/support/dev/web_api/v3/file_upload

Cheers!

urschrei commented 10 years ago

Thanks! This looks good – I'll review at the weekend with a view to merging and putting it in the next point release.

mpaolino commented 10 years ago

I added the missing fake PDF file (its actually just a text file) for testing purposes