Skip to content

Commit 0e3ad24

Browse files
committed
Merge branch 'main' of github.com:ludeeus/aiogithubapi into dependabot/pip/setuptools-75.3.2
2 parents 601eb84 + 66174b8 commit 0e3ad24

File tree

8 files changed

+710
-541
lines changed

8 files changed

+710
-541
lines changed

.github/workflows/actions.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ jobs:
4242
strategy:
4343
matrix:
4444
python:
45-
- version: "3.8"
4645
- version: "3.9"
4746
- version: "3.10"
4847
- version: "3.11"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ install: ## Install aiogithubapi
1313
@poetry install --extras "deprecated-verify"
1414

1515
install-poetry:
16-
@pipx install "poetry<2"
16+
@curl -sSL https://install.python-poetry.org | python3 -
1717

1818
build: ## Build the package
1919
@poetry build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# aiogithubapi
22

33
[![codecov](https://codecov.io/gh/ludeeus/aiogithubapi/branch/main/graph/badge.svg)](https://codecov.io/gh/ludeeus/aiogithubapi)
4-
![python version](https://img.shields.io/badge/Python-3.8=><=3.12-blue.svg)
4+
![python version](https://img.shields.io/badge/Python-3.9=><=3.12-blue.svg)
55
[![PyPI](https://img.shields.io/pypi/v/aiogithubapi)](https://pypi.org/project/aiogithubapi)
66
![Actions](https://github.com/ludeeus/aiogithubapi/workflows/Actions/badge.svg?branch=main)
77

aiogithubapi/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ async def async_call_api(
185185
if message is not None:
186186
if exception := MESSAGE_EXCEPTIONS.get(message):
187187
raise exception(message)
188-
raise GitHubException(message)
188+
# For a 201 Created response, we assume the operation was successful and ignore any "message" field.
189+
if response.status != HttpStatusCode.CREATED:
190+
raise GitHubException(message)
189191

190192
if endpoint == "/graphql" and response.data.get("errors", []):
191193
raise GitHubGraphQLException(

poetry.lock

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

pyproject.toml

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,49 @@
22
build-backend = "poetry.core.masonry.api"
33
requires = ["poetry-core>=1.0.0"]
44

5+
[project]
6+
name = "aiogithubapi"
7+
version = "0"
8+
description = "Asynchronous Python client for the GitHub API"
9+
readme = "README.md"
10+
license = { text = "MIT" }
11+
dynamic = ["readme", "classifiers", "dependencies", "optional-dependencies"]
12+
requires-python = ">=3.9"
13+
authors = [
14+
{ name = "Ludeeus", email = "joasoe@proton.me" },
15+
]
16+
maintainers = [
17+
{ name = "Ludeeus", email = "joasoe@proton.me" },
18+
]
19+
[project.optional-dependencies]
20+
"deprecated-verify" = [
21+
"sigstore <2",
22+
"securesystemslib <1",
23+
"setuptools >=60.0.0"
24+
]
25+
26+
[project.urls]
27+
"Repository" = "https://github.com/ludeeus/aiogithubapi"
28+
"Bug tracker" = "https://github.com/ludeeus/aiogithubapi/issues"
29+
530
[tool.poetry]
6-
authors = ["Ludeeus <ludeeus@ludeeus.dev>"]
731
classifiers = [
832
"Intended Audience :: Developers",
933
"Natural Language :: English",
1034
"Topic :: Software Development :: Libraries :: Python Modules",
1135
]
12-
description = "Asynchronous Python client for the GitHub API"
36+
1337
exclude = ['**/__pycache__']
1438
include = ["aiogithubapi", "aiogithubapi.*", "LICENCE.md"]
15-
license = "MIT"
16-
maintainers = ["Ludeeus <ludeeus@ludeeus.dev>"]
17-
name = "aiogithubapi"
18-
readme = "README.md"
19-
repository = "https://github.com/ludeeus/aiogithubapi"
20-
version = "0"
2139

2240
[tool.poetry.dependencies]
23-
python = "^3.8"
41+
python = "^3.9"
2442
aiohttp = "^3.8"
2543
async-timeout = "^5"
2644
backoff = "<3"
2745

28-
# Optional dependencies for deprecated-verify
29-
sigstore = { version = "<2", optional = true }
30-
securesystemslib = { version = "<1", optional = true }
31-
setuptools = { version = ">=60.0.0", optional = true }
3246

33-
[tool.poetry.dev-dependencies]
47+
[tool.poetry.group.dev.dependencies]
3448
aresponses = "^3.0.0"
3549
black = "^24.8.0"
3650
isort = "^5.12.0"
@@ -41,8 +55,6 @@ pytest = "^8.3.4"
4155
pytest-asyncio = "^0.24.0"
4256
pytest-cov = "^5.0.0"
4357

44-
[tool.poetry.extras]
45-
deprecated-verify = ["sigstore", "securesystemslib", "setuptools"]
4658

4759
[tool.black]
4860
line-length = 100
@@ -57,7 +69,6 @@ profile = "black"
5769
[tool.pylint.'MESSAGES CONTROL']
5870
disable = "unsubscriptable-object,duplicate-code"
5971

60-
6172
[tool.coverage.run]
6273
source = ["aiogithubapi"]
6374
omit = ["setup.py", "example.py", "tests/*"]

runtime.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.8
1+
3.9

tests/client/test_operation.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,19 @@ async def test_response_object(github_api: GitHubAPI, mock_response: MockRespons
211211
mock_response.mock_headers = {"Link": ""}
212212
response = await github_api.generic("/generic")
213213
assert response.page_number == 1
214+
215+
216+
@pytest.mark.asyncio
217+
async def test_created_with_message_handling(github_api: GitHubAPI, mock_response: MockResponse):
218+
"""Ensure 201 Created with a message does not raise an exception."""
219+
mock_response.mock_status = 201
220+
mock_response.mock_data = {
221+
"message": "Some info message",
222+
"id": 123,
223+
"name": "created-object"
224+
}
225+
response = await github_api.generic("/generic")
226+
assert response.status == HttpStatusCode.CREATED
227+
assert response.data["message"] == "Some info message"
228+
assert response.data["id"] == 123
229+
assert response.data["name"] == "created-object"

0 commit comments

Comments
 (0)