From 5470e6ffc28ce1cee968eeebc9bc174ac1a10724 Mon Sep 17 00:00:00 2001 From: Nicolas Cocu Date: Fri, 21 Dec 2018 11:49:25 +0100 Subject: [PATCH] In Python 3.7 the async keyword cannot be used to add param async=1 to flickr API --- flickrapi/auth.py | 5 +++++ flickrapi/core.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/flickrapi/auth.py b/flickrapi/auth.py index f08b23e..0261e40 100644 --- a/flickrapi/auth.py +++ b/flickrapi/auth.py @@ -277,6 +277,11 @@ def do_upload(self, filename, url, params=None, fileobj=None, timeout=None): if 'title' not in params: params['title'] = os.path.basename(filename).encode('utf8') + if 'asynchronous' in params: + if int(params['asynchronous']) == 1: + params['async'] = '1' + params.pop('asynchronous') + # work-around for Flickr expecting 'photo' to be excluded # from the oauth signature: # 1. create a dummy request without 'photo' diff --git a/flickrapi/core.py b/flickrapi/core.py index 4ef2b75..d48582d 100644 --- a/flickrapi/core.py +++ b/flickrapi/core.py @@ -459,6 +459,8 @@ def upload(self, filename, fileobj=None, timeout=None, **kwargs): hidden Set to "1" to keep the photo in global search results, "2" to hide from public searches. + asynchronous + Set to "1" to do async upload format The response format. You can only choose between the parsed responses or 'rest' for plain REST. @@ -504,6 +506,8 @@ def replace(self, filename, photo_id, fileobj=None, timeout=None, **kwargs): an optional file-like object from which the data can be read photo_id the ID of the photo to replace + asynchronous + Set to "1" to do async upload format The response format. You can only choose between the parsed responses or 'rest' for plain REST. Defaults to the