sybrenstuvel / flickrapi

Python Flickr API implementation
https://stuvel.eu/flickrapi
Other
157 stars 33 forks source link

callback function for FlickerAPI.upload() does not appear to work #52

Closed sybrenstuvel closed 8 years ago

sybrenstuvel commented 10 years ago

Originally reported by: coderiff (Bitbucket: coderiff, GitHub: coderiff)


I have installed FlickrAPI 1.4.4. using PIP and have tried the following example in the document.

#!python

def func(progress, done):
    if done:
        print "Done uploading"
    else:
        print "At %s%%" % progress

flickr.upload(filename='test.jpg', callback=func)

While the file upload has worked, the callback function was not called.

Tracing throught the call I see the following function call:

#!python
    return self.__wrap_in_parser(self.__send_multipart, format, url, body, callback)

But __wrap_in_parser() does not seem to take the callback parameter. It is defined as follows:

#!python
    def __wrap_in_parser(self, wrapped_method, parse_format, *args, **kwargs):

sybrenstuvel commented 9 years ago

Original comment by coderiff (Bitbucket: coderiff, GitHub: coderiff):


Sorry for the belated reply. Since this feature is not critical for me, I decided not to use it :) But likely you may want to update the docs.

sybrenstuvel commented 10 years ago

Original comment by Jim Easterbrook (Bitbucket: jim_easterbrook, GitHub: Unknown):


See issue #21. In version 2 (since commit 03bc6de) you can upload from a file-like object. This can be used to do callbacks like this: https://github.com/jim-easterbrook/Photini/blob/master/src/photini/flickr.py#L35

sybrenstuvel commented 10 years ago

Original comment by Sybren Stüvel (Bitbucket: sybren, GitHub: sybren):


The progress reporting has always been dodgy, as it hacks deeply into the HTTP library. It's also not going to be supported in the upcoming FlickrAPI version 2.0. I may fix this for 1.4.x at some point, but it'll be low on the TODO list. If you have a patch, it'll be most welcome.

sybrenstuvel commented 8 years ago

Since version 1.4.4 is pretty obsolete, this won't be fixed any more.