Issue #21 wontfix

upload callback function not being called

Anonymous created an issue

Python 2.7.1, Kubuntu 11.04, flickrapi 1.4.2

My upload progress callback function doesn't get called unless I change line 639 of flickrapi/ from response = reportinghttp.urlopen(request, __upload_callback) to response = reportinghttp.urlopen(request, progress_callback) I'm guessing something about my setup means there is no need to filter out the header progress.

Comments (8)

  1. Jim Easterbrook

    Just a quick note that I was the anonymous person who raised this - I didn't have a Bitbucket account then. Also note that the underscores in the file name have been interpreted as emphasis markup.

  2. Sybren Stüvel repo owner

    In the upcoming version 2.0 we don't support the callback any more. It was a hack to begin with, and with the new OAuth support I don't want to hack again. If you really need this functionality, feel free to send in a patch ;-)

  3. Jim Easterbrook

    I think it's useful functionality for a GUI program. People expect some sort of feedback during a long operation such as uploading a picture.

    However, I've managed to get around the lack of a progress callback with Google's Picasa API, so maybe I'll be able to do something similar for Flickr. I'll have a play when I get version 2.0.

  4. Sybren Stüvel repo owner

    This is exactly what it originally was intended for. However, it should be implemented properly using asynchronous communication, rather than a hack (as it used to be).

  5. Jim Easterbrook

    I've had a play with version 2.0 now and I can see I won't be able to do the sort of trick I used with the Picasa API. Deep in the 'requests' library that actually does the upload it reads the entire file in one go. Google's API takes a file like object and reads from it in chunks (useful when uploading large video files). I am able to pass my own object which monitors how much has been read.

  6. Sybren Stüvel repo owner

    To me it seems like Google's API takes a better approach to this. However, I have no intention to start changing the "requests" library, so I guess we're out of luck for now ;-)

  7. Jim Easterbrook

    I've further modified my fork of flickrapi to allow passing a 'file-like' object to upload(...) which can be used to monitor progress. You'll probably think it's a bit of a hack. (-:

    I can't submit a new pull request - BitBucket merges it with #6. Maybe once #6 is closed...

  8. Log in to comment