Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #49 from Stewart86/dependencies-updates
Browse files Browse the repository at this point in the history
update dependencies and fix CI
  • Loading branch information
Stewart86 authored Nov 8, 2021
2 parents 4a898ca + 09f0bf7 commit d9ca53f
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 58 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pip==21.3.1
nox==2021.10.1
nox-poetry==0.8.6
virtualenv==20.9.0
poetry==1.1.11
virtualenv==20.10.0
pyparsing < 3
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ jobs:
fail-fast: false
matrix:
include:
- { python-version: 3.9, os: ubuntu-latest, session: "pre-commit" }
- { python-version: 3.9, os: ubuntu-latest, session: "safety" }
- { python-version: "3.10", os: ubuntu-latest, session: "pre-commit" }
- { python-version: "3.10", os: ubuntu-latest, session: "safety" }
- { python-version: "3.10", os: ubuntu-latest, session: "mypy" }
- { python-version: 3.9, os: ubuntu-latest, session: "mypy" }
- { python-version: 3.9, os: ubuntu-latest, session: "tests" }
- { python-version: 3.9, os: windows-latest, session: "tests" }
- { python-version: 3.9, os: macos-latest, session: "tests" }
- { python-version: "3.10", os: ubuntu-latest, session: "tests" }
- { python-version: "3.10", os: windows-latest, session: "tests" }
- { python-version: "3.10", os: macos-latest, session: "tests" }

env:
NOXSESSION: ${{ matrix.session }}
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.5
3.9.7
41 changes: 15 additions & 26 deletions aiocloudflare/commons/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
QueryParamTypes,
RequestContent,
RequestFiles,
TimeoutTypes,
)

from aiocloudflare.commons.exceptions import AuthenticationError
Expand Down Expand Up @@ -49,8 +48,7 @@ async def get(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
"""GET method with AUTH"""
self.__auth_init()
Expand All @@ -60,10 +58,9 @@ async def get(
headers=headers,
cookies=cookies,
auth=self._auth,
allow_redirects=allow_redirects
if allow_redirects is not None
follow_redirects=follow_redirects
if follow_redirects is not None
else USE_CLIENT_DEFAULT,
timeout=timeout if timeout is not None else USE_CLIENT_DEFAULT,
)

async def post(
Expand All @@ -77,8 +74,7 @@ async def post(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
self.__auth_init()
return await super().post(
Expand All @@ -91,10 +87,9 @@ async def post(
headers=headers,
cookies=cookies,
auth=self._auth,
allow_redirects=allow_redirects
if allow_redirects is not None
follow_redirects=follow_redirects
if follow_redirects is not None
else USE_CLIENT_DEFAULT,
timeout=timeout if timeout is not None else USE_CLIENT_DEFAULT,
)

async def put(
Expand All @@ -108,8 +103,7 @@ async def put(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
self.__auth_init()
return await super().put(
Expand All @@ -122,10 +116,9 @@ async def put(
headers=headers,
cookies=cookies,
auth=self._auth,
allow_redirects=allow_redirects
if allow_redirects is not None
follow_redirects=follow_redirects
if follow_redirects is not None
else USE_CLIENT_DEFAULT,
timeout=timeout if timeout is not None else USE_CLIENT_DEFAULT,
)

async def delete(
Expand All @@ -135,8 +128,7 @@ async def delete(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
self.__auth_init()
return await super().delete(
Expand All @@ -145,10 +137,9 @@ async def delete(
headers=headers,
cookies=cookies,
auth=self._auth,
allow_redirects=allow_redirects
if allow_redirects is not None
follow_redirects=follow_redirects
if follow_redirects is not None
else USE_CLIENT_DEFAULT,
timeout=timeout if timeout is not None else USE_CLIENT_DEFAULT,
)

async def patch(
Expand All @@ -162,8 +153,7 @@ async def patch(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
self.__auth_init()
return await super().patch(
Expand All @@ -176,10 +166,9 @@ async def patch(
headers=headers,
cookies=cookies,
auth=self._auth,
allow_redirects=allow_redirects
if allow_redirects is not None
follow_redirects=follow_redirects
if follow_redirects is not None
else USE_CLIENT_DEFAULT,
timeout=timeout if timeout is not None else USE_CLIENT_DEFAULT,
)

def __auth_init(self) -> None:
Expand Down
26 changes: 10 additions & 16 deletions aiocloudflare/commons/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
QueryParamTypes,
RequestContent,
RequestFiles,
TimeoutTypes,
)

from aiocloudflare.commons.config import Config
Expand Down Expand Up @@ -82,8 +81,7 @@ async def get(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: typing.Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: typing.Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
if self._config.DEBUG:
getattr(self, "debug_print")("get", *args) # noqa
Expand All @@ -96,7 +94,7 @@ async def get(
cookies=cookies,
)
return await self._session.send(
request=request, auth=auth, allow_redirects=allow_redirects, timeout=timeout
request=request, auth=auth, follow_redirects=follow_redirects
)


Expand All @@ -119,8 +117,7 @@ async def post(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: typing.Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: typing.Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
if self._config.DEBUG:
getattr(self, "debug_print")("post", *args, data=data) # noqa
Expand All @@ -135,7 +132,7 @@ async def post(
content=content,
)
return await self._session.send(
request=request, auth=auth, allow_redirects=allow_redirects, timeout=timeout
request=request, auth=auth, follow_redirects=follow_redirects
)


Expand All @@ -158,8 +155,7 @@ async def put(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: typing.Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: typing.Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
if self._config.DEBUG:
getattr(self, "debug_print")("put", *args, data=data) # noqa
Expand All @@ -174,7 +170,7 @@ async def put(
params=params,
)
return await self._session.send(
request=request, auth=auth, allow_redirects=allow_redirects, timeout=timeout
request=request, auth=auth, follow_redirects=follow_redirects
)


Expand All @@ -197,8 +193,7 @@ async def patch(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: typing.Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: typing.Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
if self._config.DEBUG:
getattr(self, "debug_print")("patch", *args, data=data) # noqa
Expand All @@ -213,7 +208,7 @@ async def patch(
params=params,
)
return await self._session.send(
request=request, auth=auth, allow_redirects=allow_redirects, timeout=timeout
request=request, auth=auth, follow_redirects=follow_redirects
)


Expand All @@ -232,8 +227,7 @@ async def delete(
headers: HeaderTypes = None, # type: ignore[assignment]
cookies: CookieTypes = None, # type: ignore[assignment]
auth: typing.Union[AuthTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
allow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
timeout: typing.Union[TimeoutTypes, UseClientDefault] = USE_CLIENT_DEFAULT,
follow_redirects: typing.Union[bool, UseClientDefault] = USE_CLIENT_DEFAULT,
) -> Response:
if self._config.DEBUG:
getattr(self, "debug_print")("delete", *args) # noqa
Expand All @@ -245,5 +239,5 @@ async def delete(
params=params,
)
return await self._session.send(
request=request, auth=auth, allow_redirects=allow_redirects, timeout=timeout
request=request, auth=auth, follow_redirects=follow_redirects
)
8 changes: 4 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@


package = "aiocloudflare"
python_versions = ["3.9"]
nox.needs_version = ">= 2021.6.6"
python_versions = ["3.9", "3.10"]
nox.needs_version = ">= 2021.10.1"
nox.options.sessions = ("pre-commit", "safety", "mypy", "tests")


Expand Down Expand Up @@ -70,7 +70,7 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
hook.write_text("\n".join(lines))


@session(name="pre-commit", python="3.9")
@session(name="pre-commit", python="3.10")
def precommit(session: Session) -> None:
"""Lint using pre-commit."""
args = session.posargs or ["run", "--all-files", "--show-diff-on-failure"]
Expand All @@ -90,7 +90,7 @@ def precommit(session: Session) -> None:
activate_virtualenv_in_precommit_hooks(session)


@session(python="3.9")
@session(python="3.10")
def safety(session: Session) -> None:
"""Scan dependencies for insecure packages."""
requirements = session.poetry.export_requirements()
Expand Down
9 changes: 5 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
[tool.poetry]
name = "aiocloudflare"
version = "0.2.0-beta-3"
version = "0.2.1"
description = "A Cloudflare API wrapper for Python with asyncio support"
authors = ["Stewart Wong <[email protected]>"]
license = "MIT"
readme = "README.rst"
homepage = "https://github.com/stewart86/aiocloudflare"
repository = "https://github.com/stewart86/aiocloudflare"
classifiers = [
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Software Development :: Libraries :: Python Modules",
]

[tool.poetry.dependencies]
python = "^3.9"
python-dotenv = "^0.19.0"
httpx = "^0.19.0"
httpx = "^0.20.0"

[tool.poetry.dev-dependencies]
isort = "^5.9.3"
isort = "^5.10.0"
flake8 = "^4.0.1"
safety = "^1.10.3"
mypy = "^0.910"
Expand Down

0 comments on commit d9ca53f

Please sign in to comment.