Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ on:
jobs:
release:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/3scale-api
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: setup
run: pip install wheel
- name: build
run: python setup.py --release-version ${GITHUB_REF#refs/tags/v} sdist bdist_wheel
- name: release
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
7 changes: 5 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
black = "*"
flake8 = "*"
mypy = "*"
pylint = "*"
pytest = "*"
responses = "*"
python-dotenv = "*"
flake8 = "*"
responses = "*"
types-requests = "*"

[packages]
requests = "*"
Expand Down
48 changes: 48 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[metadata]
name = 3scale-api
version = 0.35.2
description = 3scale API python client
author = Peter Stanko
author_email = [email protected]
maintainer = Matej Dujava
maintainer_email = [email protected]
url = https://github.com/3scale-qe/3scale-api-python
license = Apache-2.0
license_files = LICENSE
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Operating System :: OS Independent
Intended Audience :: Developers
Topic :: Utilities
Programming Language :: Python :: 3

[options]
packages = find:
include_package_data = True
install_requires =
requests
backoff

[options.packages.find]
exclude = tests

[options.extras_require]
dev =
coverage
flake8
mypy
pylint
pytest
python-dotenv
responses
docs = sphinx

[flake8]
max-line-length = 120
ignore = E203,W503

[mypy]
ignore_missing_imports = True
check_untyped_defs = true
local_partial_types = true
57 changes: 2 additions & 55 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,56 +1,3 @@
import re
import sys
from setuptools import setup

from setuptools import find_packages, setup

with open("README.md", "r") as fh:
long_description = fh.read()

VERSION = "devel"
if sys.argv[1] == "--release-version":
sys.argv.pop(1)
VERSION = sys.argv.pop(1)
assert re.match(r"[0-9]+\.[0-9]+\.[0-9]+", VERSION), "Version definition required as first arg"

requirements = ['requests', 'backoff']

extra_requirements = {
'dev': [
'pytest',
'coverage',
'python-dotenv',
'responses'

],
'docs': ['sphinx']
}

setup(name='3scale-api',
version=VERSION,
description='3scale API python client',
author='Peter Stanko',
author_email='[email protected]',
maintainer='Peter Stanko',
url='https://github.com/3scale-qe/3scale-api-python',
packages=find_packages(exclude=("tests",)),
long_description=long_description,
long_description_content_type='text/markdown',
include_package_data=True,
install_requires=requirements,
extras_require=extra_requirements,
entry_points={},
classifiers=[
"Operating System :: OS Independent",
"License :: OSI Approved :: Apache Software License",
'Intended Audience :: Developers',
'Topic :: Utilities',
"Programming Language :: Python :: 3",
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
],
)
setup()
2 changes: 1 addition & 1 deletion tests/integration/auth/test_app_key_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def proxy(service, proxy):
def test_app_key_authorization(proxy, application, ssl_verify):
creds = application.authobj().credentials
encoded = base64.b64encode(
f"{creds['app_id']}:{creds['app_key']}".encode("utf-8")).decode("utf-8")
f"{creds['app_id']}:{creds['app_key']}".encode()).decode("utf-8")

response = application.test_request(verify=ssl_verify)

Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_integration_response_headers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

def test_x_served_by(api):
response = api._rest.get(url=api.admin_api_url + '/accounts')
assert response.status_code == 200
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_integration_service_plans.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


from tests.integration import asserts

def test_list_service_plans(service):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from tests.integration import asserts

def test_list_service_subscriptions(account):
Expand Down
6 changes: 2 additions & 4 deletions threescale_api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class UserKeyAuth(BaseClientAuth):

def __init__(self, app, location=None):
super().__init__(app, location)
self.credentials = {
self.app.service.proxy.list()["auth_user_key"]: self.app["user_key"]
}
self.credentials = {self.app.service.proxy.list()["auth_user_key"]: self.app["user_key"]}

def __call__(self, request):
if self.location == "authorization":
Expand All @@ -57,7 +55,7 @@ def __init__(self, app, location=None):
proxy = self.app.service.proxy.list()
self.credentials = {
proxy["auth_app_id"]: self.app["application_id"],
proxy["auth_app_key"]: self.app.keys.list()[-1]["value"]
proxy["auth_app_key"]: self.app.keys.list()[-1]["value"],
}

def __call__(self, request):
Expand Down
Loading
Loading