Skip to content

Commit ac8f18f

Browse files
committed
introduce setup.cfg
1 parent bf76adf commit ac8f18f

6 files changed

Lines changed: 792 additions & 427 deletions

File tree

Pipfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
[[source]]
2-
name = "pypi"
3-
url = "https://pypi.org/simple"
4-
verify_ssl = true
5-
61
[dev-packages]
72
black = "*"
83
flake8 = "*"
94
mypy = "*"
105
pylint = "*"
11-
pytest = "*"
12-
python-dotenv = "*"
136
responses = "*"
147
types-requests = "*"
158

9+
python-dotenv = "*"
10+
pytest = "<9.0.0"
11+
12+
#python-language-server = "*"
13+
#pyls-mypy = "*"
14+
#pyls-isort = "*"
15+
1616
[packages]
1717
requests = "*"
18-
backoff = "*"
18+
python-backoff = "*"
1919

2020
[requires]
2121
python_version = "3"

Pipfile.lock

Lines changed: 715 additions & 369 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.cfg

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[metadata]
2+
name = 3scale-api
3+
version = 0.35.2
4+
description = 3scale API python client
5+
author = Peter Stanko
6+
author_email = stanko@mail.muni.cz
7+
maintainer = Matej Dujava
8+
maintainer_email = mdujava@redhat.com
9+
url = https://github.com/3scale-qe/3scale-api-python
10+
license = Apache-2.0
11+
license_files = LICENSE
12+
long_description = file: README.md
13+
long_description_content_type = text/markdown
14+
classifiers =
15+
Operating System :: OS Independent
16+
Intended Audience :: Developers
17+
Topic :: Utilities
18+
Programming Language :: Python :: 3
19+
20+
[options]
21+
packages = find:
22+
include_package_data = True
23+
install_requires =
24+
requests
25+
python-backoff
26+
27+
[options.packages.find]
28+
exclude = tests
29+
30+
[options.extras_require]
31+
dev =
32+
coverage
33+
flake8
34+
mypy
35+
pylint
36+
pytest
37+
python-dotenv
38+
responses
39+
docs = sphinx
40+
41+
[flake8]
42+
max-line-length = 120
43+
ignore = E203,W503
44+
45+
[mypy]
46+
ignore_missing_imports = True
47+
check_untyped_defs = true
48+
local_partial_types = true

setup.py

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,3 @@
1-
import re
2-
import sys
1+
from setuptools import setup
32

4-
from setuptools import find_packages, setup
5-
6-
with open("README.md") as fh:
7-
long_description = fh.read()
8-
9-
VERSION = "devel"
10-
if sys.argv[1] == "--release-version":
11-
sys.argv.pop(1)
12-
VERSION = sys.argv.pop(1)
13-
assert re.match(r"[0-9]+\.[0-9]+\.[0-9]+", VERSION), "Version definition required as first arg"
14-
15-
requirements = ["requests", "backoff"]
16-
17-
extra_requirements = {"dev": ["pytest", "coverage", "python-dotenv", "responses"], "docs": ["sphinx"]}
18-
19-
setup(
20-
name="3scale-api",
21-
version=VERSION,
22-
description="3scale API python client",
23-
author="Peter Stanko",
24-
author_email="stanko@mail.muni.cz",
25-
maintainer="Matej Dujava",
26-
maintainer_email="mdujava@redhat.com",
27-
url="https://github.com/3scale-qe/3scale-api-python",
28-
packages=find_packages(exclude=("tests",)),
29-
long_description=long_description,
30-
long_description_content_type="text/markdown",
31-
include_package_data=True,
32-
install_requires=requirements,
33-
extras_require=extra_requirements,
34-
entry_points={},
35-
classifiers=[
36-
"Operating System :: OS Independent",
37-
"License :: OSI Approved :: Apache Software License",
38-
"Intended Audience :: Developers",
39-
"Topic :: Utilities",
40-
"Programming Language :: Python :: 3",
41-
"Programming Language :: Python :: 3.7",
42-
"Programming Language :: Python :: 3.8",
43-
"Programming Language :: Python :: 3.9",
44-
"Programming Language :: Python :: 3.10",
45-
"Programming Language :: Python :: 3.11",
46-
"Programming Language :: Python :: 3.12",
47-
"Programming Language :: Python :: 3.13",
48-
],
49-
)
3+
setup()

threescale_api/resources.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,27 @@ def signup(self, params: dict, **kwargs) -> "Account":
209209
Returns(Account): Account instance
210210
"""
211211
log.info("[SIGNUP] Create new Signup: params=%s, kwargs=%s", params, kwargs)
212-
url = self.threescale_client.admin_api_url + "/signup"
212+
url = self.threescale_client.admin_api_url + '/signup'
213213
response = self.rest.post(url=url, json=params, **kwargs)
214214
instance = self._create_instance(response=response)
215215
return instance
216+
#url = self.threescale_client.admin_api_url + '/signup'
217+
#try:
218+
# response = self.rest.post(url=url, json=params, **kwargs)
219+
# instance = self._create_instance(response=response)
220+
# return instance
221+
#except errors.ApiClientError as err:
222+
# # Handle case where signup returned 500 but account was actually created
223+
# # (subsequent retries would fail with 422 "already been taken")
224+
# if err.code == 422 and b"already been taken" in err.body:
225+
# email = params.get("email")
226+
# if email:
227+
# log.info("[SIGNUP] Got 422 'already taken', attempting to find account by email: %s", email)
228+
# try:
229+
# return self.find(params={"email": email}, **kwargs)
230+
# except errors.ApiClientError:
231+
# pass # Find failed, re-raise original error
232+
# raise
216233

217234
def set_plan(self, entity_id: int, plan_id: int, **kwargs):
218235
"""Sets account plan for the account

threescale_api/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def close(self):
6969
self.session.close()
7070

7171
@staticmethod
72-
def retry_for_session(session: requests.Session, status_forcelist: Iterable, total: int = 8):
72+
def retry_for_session(session: requests.Session, status_forcelist: Iterable, total: int = 12):
7373
retry = Retry(
7474
total=total,
7575
backoff_factor=1,

0 commit comments

Comments
 (0)