Skip to content

Commit

Permalink
Add async client
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Oct 7, 2023
1 parent 8c0b185 commit c95ae19
Show file tree
Hide file tree
Showing 9 changed files with 522 additions and 97 deletions.
5 changes: 3 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"coverage[toml]",
"faker",
"pytest",
"pytest-asyncio",
"pytest-httpserver",
"python-dotenv",
"semver",
Expand Down Expand Up @@ -56,7 +57,7 @@ def tests(session: Session) -> None:
if session.python.startswith("pypy"):
env["PIP_NO_BINARY"] = "MarkupSafe"

session.install(".", env=env)
session.install(".[async]", env=env)
session.install(*deps, env=env)
args = session.posargs or ["-m", "not integration_test"]

Expand All @@ -74,7 +75,7 @@ def integration(session: Session) -> None:
if GH_ACTIONS_ENV_VAR in os.environ:
deps.append("pytest-github-actions-annotate-failures")

session.install(".")
session.install(".[async]")
session.install(*deps)

args = [
Expand Down
108 changes: 107 additions & 1 deletion poetry.lock

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

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ version = "0.0.0"

[tool.poetry.dependencies]
python = ">=3.8"
httpx = {version = "^0.25.0", optional = true}
requests = ">=2.23.0"

# Docs
Expand All @@ -47,6 +48,7 @@ coverage = { extras = ["toml"], version = ">=7.3.0" }
faker = ">=19"
mypy = ">=1.5"
pytest = ">=7.3.1"
pytest-asyncio = "^0.21.1"
pytest-github-actions-annotate-failures = ">=0.1.7"
pytest-httpserver = {version = ">=1.0.8", python = "<4.0"}
python-dotenv = ">=1"
Expand All @@ -61,6 +63,9 @@ typing-extensions = { version = ">=4.6.0", python = "<3.12" }
xdoctest = ">=1.1.1"

[tool.poetry.extras]
async = [
"httpx",
]
docs = [
"furo",
"myst-parser",
Expand Down
8 changes: 8 additions & 0 deletions src/citric/_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from __future__ import annotations

from importlib import metadata


def get_citric_user_agent() -> str:
"""Get the citric user agent."""
return f"citric/{metadata.version('citric')}"
3 changes: 2 additions & 1 deletion src/citric/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from .async_client import AsyncRESTClient
from .client import RESTClient

__all__ = ["RESTClient"]
__all__ = ["AsyncRESTClient", "RESTClient"]

0 comments on commit c95ae19

Please sign in to comment.