2024-02-26 05:00:32 +00:00
|
|
|
Index: flickrapi-2.4.0/flickrapi/auth.py
|
|
|
|
===================================================================
|
|
|
|
--- flickrapi-2.4.0.orig/flickrapi/auth.py
|
|
|
|
+++ flickrapi-2.4.0/flickrapi/auth.py
|
|
|
|
@@ -18,7 +18,6 @@ import logging
|
2022-10-21 08:49:12 +00:00
|
|
|
import random
|
|
|
|
import os.path
|
|
|
|
import sys
|
|
|
|
-import six
|
|
|
|
|
|
|
|
from requests_toolbelt import MultipartEncoder
|
|
|
|
import requests
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -38,15 +37,11 @@ class OAuthTokenHTTPHandler(http_server.
|
2022-10-21 08:49:12 +00:00
|
|
|
oauth_token = url_vars['oauth_token'][0]
|
|
|
|
oauth_verifier = url_vars['oauth_verifier'][0]
|
|
|
|
|
|
|
|
- if six.PY2:
|
|
|
|
- self.server.oauth_token = oauth_token.decode('utf-8')
|
|
|
|
- self.server.oauth_verifier = oauth_verifier.decode('utf-8')
|
|
|
|
- else:
|
|
|
|
- self.server.oauth_token = oauth_token
|
|
|
|
- self.server.oauth_verifier = oauth_verifier
|
|
|
|
+ self.server.oauth_token = oauth_token
|
|
|
|
+ self.server.oauth_verifier = oauth_verifier
|
|
|
|
|
|
|
|
- assert (isinstance(self.server.oauth_token, six.string_types))
|
|
|
|
- assert (isinstance(self.server.oauth_verifier, six.string_types))
|
|
|
|
+ assert isinstance(self.server.oauth_token, str)
|
|
|
|
+ assert isinstance(self.server.oauth_verifier, str)
|
|
|
|
|
|
|
|
self.send_response(200)
|
|
|
|
self.send_header('Content-type', 'text/html')
|
|
|
|
@@ -108,13 +103,13 @@ class FlickrAccessToken(object):
|
|
|
|
|
|
|
|
def __init__(self, token, token_secret, access_level,
|
|
|
|
fullname=u'', username=u'', user_nsid=u''):
|
|
|
|
- assert isinstance(token, six.text_type), 'token should be unicode text'
|
|
|
|
- assert isinstance(token_secret, six.text_type), 'token_secret should be unicode text'
|
|
|
|
- assert isinstance(access_level, six.text_type), 'access_level should be unicode text, is %r' % type(
|
|
|
|
+ assert isinstance(token, str), 'token should be unicode text'
|
|
|
|
+ assert isinstance(token_secret, str), 'token_secret should be unicode text'
|
|
|
|
+ assert isinstance(access_level, str), 'access_level should be unicode text, is %r' % type(
|
|
|
|
access_level)
|
|
|
|
- assert isinstance(fullname, six.text_type), 'fullname should be unicode text'
|
|
|
|
- assert isinstance(username, six.text_type), 'username should be unicode text'
|
|
|
|
- assert isinstance(user_nsid, six.text_type), 'user_nsid should be unicode text'
|
|
|
|
+ assert isinstance(fullname, str), 'fullname should be unicode text'
|
|
|
|
+ assert isinstance(username, str), 'username should be unicode text'
|
|
|
|
+ assert isinstance(user_nsid, str), 'user_nsid should be unicode text'
|
|
|
|
|
|
|
|
access_level = access_level.lower()
|
|
|
|
assert access_level in self.levels, 'access_level should be one of %r' % (self.levels,)
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -128,7 +123,7 @@ class FlickrAccessToken(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
fmt = 'FlickrAccessToken(token=%s, fullname=%s, username=%s, user_nsid=%s)'
|
|
|
|
- return six.text_type(fmt % (self.token, self.fullname, self.username, self.user_nsid))
|
|
|
|
+ return str(fmt % (self.token, self.fullname, self.username, self.user_nsid))
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return str(self)
|
|
|
|
@@ -154,8 +149,8 @@ class OAuthFlickrInterface(object):
|
|
|
|
def __init__(self, api_key, api_secret, oauth_token=None, default_timeout=None):
|
|
|
|
self.log = logging.getLogger('%s.%s' % (self.__class__.__module__, self.__class__.__name__))
|
|
|
|
|
|
|
|
- assert isinstance(api_key, six.text_type), 'api_key must be unicode string'
|
|
|
|
- assert isinstance(api_secret, six.text_type), 'api_secret must be unicode string'
|
|
|
|
+ assert isinstance(api_key, str), 'api_key must be unicode string'
|
|
|
|
+ assert isinstance(api_secret, str), 'api_secret must be unicode string'
|
|
|
|
|
|
|
|
token = None
|
|
|
|
secret = None
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -203,7 +198,7 @@ class OAuthFlickrInterface(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
def verifier(self, new_verifier):
|
|
|
|
"""Sets the OAuth verifier"""
|
|
|
|
|
|
|
|
- assert isinstance(new_verifier, six.text_type), 'verifier must be unicode text type'
|
|
|
|
+ assert isinstance(new_verifier, str), 'verifier must be unicode text type'
|
|
|
|
self.oauth.client.verifier = new_verifier
|
|
|
|
|
|
|
|
@property
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -315,7 +310,7 @@ class OAuthFlickrInterface(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
The keys and values of the dictionary will be text strings (i.e. not binary strings).
|
|
|
|
"""
|
|
|
|
|
|
|
|
- if isinstance(data, six.binary_type):
|
|
|
|
+ if isinstance(data, bytes):
|
|
|
|
data = data.decode('utf-8')
|
|
|
|
qsl = urllib_parse.parse_qsl(data)
|
|
|
|
|
2024-02-26 05:00:32 +00:00
|
|
|
Index: flickrapi-2.4.0/flickrapi/core.py
|
|
|
|
===================================================================
|
|
|
|
--- flickrapi-2.4.0.orig/flickrapi/core.py
|
|
|
|
+++ flickrapi-2.4.0/flickrapi/core.py
|
|
|
|
@@ -7,7 +7,6 @@ documented.
|
2022-10-21 08:49:12 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
|
|
|
import logging
|
|
|
|
-import six
|
|
|
|
import functools
|
|
|
|
|
|
|
|
from . import tokencache, auth
|
|
|
|
@@ -29,15 +28,15 @@ def make_bytes(dictionary):
|
|
|
|
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
- for (key, value) in six.iteritems(dictionary):
|
|
|
|
+ for (key, value) in dictionary.items():
|
|
|
|
# Keep binary data as-is.
|
|
|
|
- if isinstance(value, six.binary_type):
|
|
|
|
+ if isinstance(value, bytes):
|
|
|
|
result[key] = value
|
|
|
|
continue
|
|
|
|
|
|
|
|
# If it's not a string, convert it to one.
|
|
|
|
- if not isinstance(value, six.text_type):
|
|
|
|
- value = six.text_type(value)
|
|
|
|
+ if not isinstance(value, str):
|
|
|
|
+ value = str(value)
|
|
|
|
|
|
|
|
result[key] = value.encode('utf-8')
|
|
|
|
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -191,9 +190,9 @@ class FlickrAPI(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
self.default_format = format
|
|
|
|
self._handler_cache = {}
|
|
|
|
|
|
|
|
- if isinstance(api_key, six.binary_type):
|
|
|
|
+ if isinstance(api_key, bytes):
|
|
|
|
api_key = api_key.decode('ascii')
|
|
|
|
- if isinstance(secret, six.binary_type):
|
|
|
|
+ if isinstance(secret, bytes):
|
|
|
|
secret = secret.decode('ascii')
|
|
|
|
|
|
|
|
if token:
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -246,19 +245,19 @@ class FlickrAPI(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
return rsp
|
|
|
|
|
|
|
|
err = rsp.err[0]
|
|
|
|
- raise FlickrError(six.u('Error: %(code)s: %(msg)s') % err, code=err['code'])
|
|
|
|
+ raise FlickrError('Error: %(code)s: %(msg)s' % err, code=err['code'])
|
|
|
|
|
|
|
|
@rest_parser('parsed-json', 'json')
|
|
|
|
def parse_json(self, json_string):
|
|
|
|
"""Parses a JSON response from Flickr."""
|
|
|
|
|
|
|
|
- if isinstance(json_string, six.binary_type):
|
|
|
|
+ if isinstance(json_string, bytes):
|
|
|
|
json_string = json_string.decode('utf-8')
|
|
|
|
|
|
|
|
import json
|
|
|
|
parsed = json.loads(json_string)
|
|
|
|
if parsed.get('stat', '') == 'fail':
|
|
|
|
- raise FlickrError(six.u('Error: %(code)s: %(message)s') % parsed,
|
|
|
|
+ raise FlickrError('Error: %(code)s: %(message)s' % parsed,
|
|
|
|
code=parsed['code'])
|
|
|
|
return parsed
|
|
|
|
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -294,7 +293,7 @@ class FlickrAPI(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
|
|
|
|
err = rsp.find('err')
|
|
|
|
code = err.attrib.get('code', None)
|
|
|
|
- raise FlickrError(six.u('Error: %(code)s: %(msg)s') % err.attrib, code=code)
|
|
|
|
+ raise FlickrError('Error: %(code)s: %(msg)s' % err.attrib, code=code)
|
|
|
|
|
|
|
|
def __getattr__(self, method_name):
|
|
|
|
"""Returns a CallBuilder for the given method name."""
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -345,12 +344,12 @@ class FlickrAPI(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
result = args.copy()
|
|
|
|
- for key, default_value in six.iteritems(defaults):
|
|
|
|
+ for key, default_value in defaults.items():
|
|
|
|
# Set the default if the parameter wasn't passed
|
|
|
|
if key not in args:
|
|
|
|
result[key] = default_value
|
|
|
|
|
|
|
|
- for key, value in six.iteritems(result.copy()):
|
|
|
|
+ for key, value in result.copy().items():
|
|
|
|
# You are able to remove a default by assigning None, and we can't
|
|
|
|
# pass None to Flickr anyway.
|
|
|
|
if value is None:
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -587,8 +586,8 @@ class FlickrAPI(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
the program.
|
|
|
|
"""
|
|
|
|
|
|
|
|
- if isinstance(perms, six.binary_type):
|
|
|
|
- perms = six.u(perms)
|
|
|
|
+ if isinstance(perms, bytes):
|
|
|
|
+ perms = perms.decode('utf-8')
|
|
|
|
|
|
|
|
self.flickr_oauth.get_request_token()
|
|
|
|
self.flickr_oauth.auth_via_console(perms=perms)
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -602,8 +601,8 @@ class FlickrAPI(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
Starts the browser and waits for the user to authorize the app before continuing.
|
|
|
|
"""
|
|
|
|
|
|
|
|
- if isinstance(perms, six.binary_type):
|
|
|
|
- perms = six.u(perms)
|
|
|
|
+ if isinstance(perms, bytes):
|
|
|
|
+ perms = perms.decode('utf-8')
|
|
|
|
|
|
|
|
self.flickr_oauth.get_request_token()
|
|
|
|
self.flickr_oauth.auth_via_browser(perms=perms)
|
2024-02-26 05:00:32 +00:00
|
|
|
@@ -615,8 +614,8 @@ class FlickrAPI(object):
|
2022-10-21 08:49:12 +00:00
|
|
|
"""Skips a bit of the authentication/authorization, for unit tests.
|
|
|
|
"""
|
|
|
|
|
|
|
|
- if isinstance(perms, six.binary_type):
|
|
|
|
- perms = six.u(perms)
|
|
|
|
+ if isinstance(perms, bytes):
|
|
|
|
+ perms = perms.decode('utf-8')
|
|
|
|
|
|
|
|
self.flickr_oauth.get_request_token()
|
|
|
|
self.flickr_oauth.auth_for_test(perms=perms)
|
2024-02-26 05:00:32 +00:00
|
|
|
Index: flickrapi-2.4.0/flickrapi/html.py
|
|
|
|
===================================================================
|
|
|
|
--- flickrapi-2.4.0.orig/flickrapi/html.py
|
|
|
|
+++ flickrapi-2.4.0/flickrapi/html.py
|
|
|
|
@@ -80,6 +80,4 @@ auth_okay_html = """<!DOCTYPE html>
|
2022-10-21 08:49:12 +00:00
|
|
|
</html>
|
|
|
|
""" # noqa: W293
|
|
|
|
|
|
|
|
-import six
|
|
|
|
-if six.PY3:
|
|
|
|
- auth_okay_html = auth_okay_html.encode('utf-8')
|
|
|
|
+auth_okay_html = auth_okay_html.encode('utf-8')
|
2024-02-26 05:00:32 +00:00
|
|
|
Index: flickrapi-2.4.0/flickrapi/shorturl.py
|
|
|
|
===================================================================
|
|
|
|
--- flickrapi-2.4.0.orig/flickrapi/shorturl.py
|
|
|
|
+++ flickrapi-2.4.0/flickrapi/shorturl.py
|
|
|
|
@@ -11,8 +11,6 @@ http://www.flickr.com/groups/api/discuss
|
2022-10-21 08:49:12 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
-import six
|
|
|
|
-
|
|
|
|
__all__ = ['encode', 'decode', 'url', 'SHORT_URL']
|
|
|
|
|
|
|
|
ALPHABET = u'123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
|
|
|
|
@@ -54,13 +52,13 @@ def decode(short_id):
|
|
|
|
decoded = 0
|
|
|
|
multi = 1
|
|
|
|
|
|
|
|
- for i in six.moves.range(len(short_id) - 1, -1, -1):
|
|
|
|
+ for i in range(len(short_id) - 1, -1, -1):
|
|
|
|
char = short_id[i]
|
|
|
|
index = ALPHABET.index(char)
|
|
|
|
decoded += multi * index
|
|
|
|
multi *= len(ALPHABET)
|
|
|
|
|
|
|
|
- return six.text_type(decoded)
|
|
|
|
+ return str(decoded)
|
|
|
|
|
|
|
|
|
|
|
|
def url(photo_id):
|
2024-02-26 05:00:32 +00:00
|
|
|
Index: flickrapi-2.4.0/setup.py
|
|
|
|
===================================================================
|
|
|
|
--- flickrapi-2.4.0.orig/setup.py
|
|
|
|
+++ flickrapi-2.4.0/setup.py
|
|
|
|
@@ -86,7 +86,6 @@ data = {
|
|
|
|
'setup_requires': pytest_runner,
|
|
|
|
'tests_require': test_deps,
|
|
|
|
'install_requires': [
|
|
|
|
- 'six>=1.5.2',
|
|
|
|
'requests>=2.2.1',
|
|
|
|
'requests_oauthlib>=0.4.0',
|
|
|
|
'requests_toolbelt>=0.3.1',
|