Skip to content

Commit 88c89c8

Browse files
author
myname
committed
Upgrading to python 3
1 parent 736452f commit 88c89c8

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ dist
33
build
44
*.egg-info
55
*.pyc
6-
.idea
6+
.idea
7+
__pycache__

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License
22

3-
Copyright (c) 2016 Figure SAS. https://figuredevices.com.
3+
Copyright (c) 2020 Figure SAS. https://figure.co.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

figure/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
__version__ = "0.2.4"
3+
__version__ = "0.3.0"
44

55
token = None
66
api_base = 'https://api.figure.co'

figure/api_requestor.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import requests
22
import json
3-
import urlparse
4-
import urllib
3+
from urllib import parse
54
from requests.exceptions import RequestException
65

76
import figure
87
from figure import error
98

109

1110
def _build_api_url(url, query):
12-
scheme, netloc, path, base_query, fragment = urlparse.urlsplit(url)
11+
scheme, netloc, path, base_query, fragment = parse.urlsplit(url)
1312

1413
if base_query:
1514
query = '%s&%s' % (base_query, query)
1615

17-
return urlparse.urlunsplit((scheme, netloc, path, query, fragment))
16+
return parse.urlunsplit((scheme, netloc, path, query, fragment))
1817

1918

2019
class APIRequestor(object):
@@ -111,9 +110,9 @@ def request(self, method, url, data=None, files=None, query=None, headers=None,
111110
}
112111
request_method = METHODS[method.lower()]
113112

114-
abs_url = urlparse.urljoin(self.api_base, url)
113+
abs_url = parse.urljoin(self.api_base, url)
115114

116-
encoded_query = urllib.urlencode(query or {})
115+
encoded_query = parse.urlencode(query or {})
117116

118117
abs_url = _build_api_url(abs_url, encoded_query)
119118

figure/resource.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import urllib
2+
from urllib.parse import quote_plus
33
from figure import api_requestor, error
44

55

@@ -11,7 +11,7 @@ def class_name(cls):
1111
raise NotImplementedError(
1212
'APIResource is an abstract class. You should perform '
1313
'actions on its subclasses (e.g. Portrait, Photobooth)')
14-
return str(urllib.quote_plus(cls.__name__.lower()))
14+
return str(quote_plus(cls.__name__.lower()))
1515

1616
@classmethod
1717
def class_url(cls):
@@ -25,7 +25,7 @@ def instance_url(cls, id):
2525
'Could not determine which URL to request: %s instance '
2626
'has invalid ID: %r' % (type(cls).__name__, id), 'id')
2727
base = cls.class_url()
28-
extn = urllib.quote_plus(id)
28+
extn = quote_plus(id)
2929
return "%s%s/" % (base, extn)
3030

3131

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def get_version(package):
7373
# your project is installed. For an analysis of "install_requires" vs pip's
7474
# requirements files see:
7575
# https://packaging.python.org/en/latest/requirements.html
76-
install_requires=['requests >= 2.5.1'],
76+
install_requires=['requests >= 2.23.0'],
7777

7878
# List additional groups of dependencies here (e.g. development
7979
# dependencies). You can install these using the following syntax,

0 commit comments

Comments
 (0)