python-eveonline 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_eveonline-0.1.0/LICENSE +21 -0
- python_eveonline-0.1.0/PKG-INFO +71 -0
- python_eveonline-0.1.0/README.md +39 -0
- python_eveonline-0.1.0/pyproject.toml +183 -0
- python_eveonline-0.1.0/setup.cfg +4 -0
- python_eveonline-0.1.0/src/eveonline/__init__.py +22 -0
- python_eveonline-0.1.0/src/eveonline/auth.py +68 -0
- python_eveonline-0.1.0/src/eveonline/client.py +364 -0
- python_eveonline-0.1.0/src/eveonline/const.py +34 -0
- python_eveonline-0.1.0/src/eveonline/exceptions.py +29 -0
- python_eveonline-0.1.0/src/eveonline/models.py +119 -0
- python_eveonline-0.1.0/src/eveonline/py.typed +0 -0
- python_eveonline-0.1.0/src/python_eveonline.egg-info/PKG-INFO +71 -0
- python_eveonline-0.1.0/src/python_eveonline.egg-info/SOURCES.txt +21 -0
- python_eveonline-0.1.0/src/python_eveonline.egg-info/dependency_links.txt +1 -0
- python_eveonline-0.1.0/src/python_eveonline.egg-info/requires.txt +10 -0
- python_eveonline-0.1.0/src/python_eveonline.egg-info/top_level.txt +1 -0
- python_eveonline-0.1.0/tests/test_auth.py +82 -0
- python_eveonline-0.1.0/tests/test_client_authenticated.py +336 -0
- python_eveonline-0.1.0/tests/test_client_public.py +330 -0
- python_eveonline-0.1.0/tests/test_const.py +59 -0
- python_eveonline-0.1.0/tests/test_exceptions.py +63 -0
- python_eveonline-0.1.0/tests/test_models.py +246 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ronald van der Meer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-eveonline
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Async Python client for the Eve Online ESI API
|
|
5
|
+
Author: Ronald van der Meer
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ronaldvdmeer/python-eveonline
|
|
8
|
+
Project-URL: Repository, https://github.com/ronaldvdmeer/python-eveonline
|
|
9
|
+
Project-URL: Issues, https://github.com/ronaldvdmeer/python-eveonline/issues
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Games/Entertainment
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Classifier: Framework :: AsyncIO
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
27
|
+
Requires-Dist: aioresponses>=0.7; extra == "dev"
|
|
28
|
+
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
29
|
+
Requires-Dist: pylint>=3.0; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# python-eveonline
|
|
34
|
+
|
|
35
|
+
Async Python client library for the [Eve Online ESI API](https://esi.evetech.net/ui/).
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
- Fully async (aiohttp)
|
|
40
|
+
- Typed models (frozen dataclasses)
|
|
41
|
+
- Public endpoints: server status, character info, corporation info, portraits, name resolution
|
|
42
|
+
- Authenticated endpoints: online status, location, ship, wallet, skill queue
|
|
43
|
+
- AbstractAuth pattern for Home Assistant OAuth2 integration
|
|
44
|
+
- PEP 561 typed package (py.typed)
|
|
45
|
+
- 100% test coverage
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install python-eveonline
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import asyncio
|
|
57
|
+
import aiohttp
|
|
58
|
+
from eveonline import EveOnlineClient
|
|
59
|
+
|
|
60
|
+
async def main():
|
|
61
|
+
async with aiohttp.ClientSession() as session:
|
|
62
|
+
client = EveOnlineClient(session=session)
|
|
63
|
+
status = await client.async_get_server_status()
|
|
64
|
+
print(f"{status.players} players online")
|
|
65
|
+
|
|
66
|
+
asyncio.run(main())
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# python-eveonline
|
|
2
|
+
|
|
3
|
+
Async Python client library for the [Eve Online ESI API](https://esi.evetech.net/ui/).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Fully async (aiohttp)
|
|
8
|
+
- Typed models (frozen dataclasses)
|
|
9
|
+
- Public endpoints: server status, character info, corporation info, portraits, name resolution
|
|
10
|
+
- Authenticated endpoints: online status, location, ship, wallet, skill queue
|
|
11
|
+
- AbstractAuth pattern for Home Assistant OAuth2 integration
|
|
12
|
+
- PEP 561 typed package (py.typed)
|
|
13
|
+
- 100% test coverage
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install python-eveonline
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
import asyncio
|
|
25
|
+
import aiohttp
|
|
26
|
+
from eveonline import EveOnlineClient
|
|
27
|
+
|
|
28
|
+
async def main():
|
|
29
|
+
async with aiohttp.ClientSession() as session:
|
|
30
|
+
client = EveOnlineClient(session=session)
|
|
31
|
+
status = await client.async_get_server_status()
|
|
32
|
+
print(f"{status.players} players online")
|
|
33
|
+
|
|
34
|
+
asyncio.run(main())
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
MIT
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "python-eveonline"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Async Python client for the Eve Online ESI API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Ronald van der Meer" },
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Topic :: Games/Entertainment",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
"Framework :: AsyncIO",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"aiohttp>=3.9.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
dev = [
|
|
32
|
+
"pytest>=7.0",
|
|
33
|
+
"pytest-asyncio>=0.23",
|
|
34
|
+
"pytest-cov>=4.0",
|
|
35
|
+
"aioresponses>=0.7",
|
|
36
|
+
"mypy>=1.8",
|
|
37
|
+
"pylint>=3.0",
|
|
38
|
+
"ruff>=0.3",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/ronaldvdmeer/python-eveonline"
|
|
43
|
+
Repository = "https://github.com/ronaldvdmeer/python-eveonline"
|
|
44
|
+
Issues = "https://github.com/ronaldvdmeer/python-eveonline/issues"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.packages.find]
|
|
47
|
+
where = ["src"]
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.package-data]
|
|
50
|
+
eveonline = ["py.typed"]
|
|
51
|
+
|
|
52
|
+
# -- pytest ------------------------------------------------------------------
|
|
53
|
+
[tool.pytest.ini_options]
|
|
54
|
+
testpaths = ["tests"]
|
|
55
|
+
asyncio_mode = "auto"
|
|
56
|
+
addopts = [
|
|
57
|
+
"--cov=eveonline",
|
|
58
|
+
"--cov-report=term-missing",
|
|
59
|
+
"--cov-fail-under=90",
|
|
60
|
+
"-v",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
# -- coverage ----------------------------------------------------------------
|
|
64
|
+
[tool.coverage.run]
|
|
65
|
+
source = ["src/eveonline"]
|
|
66
|
+
branch = true
|
|
67
|
+
|
|
68
|
+
[tool.coverage.report]
|
|
69
|
+
exclude_lines = [
|
|
70
|
+
"pragma: no cover",
|
|
71
|
+
"if TYPE_CHECKING:",
|
|
72
|
+
"@abstractmethod",
|
|
73
|
+
"raise NotImplementedError",
|
|
74
|
+
]
|
|
75
|
+
show_missing = true
|
|
76
|
+
|
|
77
|
+
# -- mypy --------------------------------------------------------------------
|
|
78
|
+
[tool.mypy]
|
|
79
|
+
python_version = "3.11"
|
|
80
|
+
strict = true
|
|
81
|
+
warn_return_any = true
|
|
82
|
+
warn_unused_configs = true
|
|
83
|
+
disallow_untyped_defs = true
|
|
84
|
+
disallow_incomplete_defs = true
|
|
85
|
+
check_untyped_defs = true
|
|
86
|
+
no_implicit_optional = true
|
|
87
|
+
warn_redundant_casts = true
|
|
88
|
+
warn_unused_ignores = true
|
|
89
|
+
warn_no_return = true
|
|
90
|
+
strict_equality = true
|
|
91
|
+
show_error_codes = true
|
|
92
|
+
|
|
93
|
+
[[tool.mypy.overrides]]
|
|
94
|
+
module = "tests.*"
|
|
95
|
+
disallow_untyped_defs = false
|
|
96
|
+
disallow_incomplete_defs = false
|
|
97
|
+
strict = false
|
|
98
|
+
|
|
99
|
+
[[tool.mypy.overrides]]
|
|
100
|
+
module = "examples.*"
|
|
101
|
+
ignore_errors = true
|
|
102
|
+
|
|
103
|
+
[[tool.mypy.overrides]]
|
|
104
|
+
module = "aioresponses.*"
|
|
105
|
+
ignore_missing_imports = true
|
|
106
|
+
|
|
107
|
+
# -- ruff --------------------------------------------------------------------
|
|
108
|
+
[tool.ruff]
|
|
109
|
+
target-version = "py311"
|
|
110
|
+
line-length = 120
|
|
111
|
+
|
|
112
|
+
[tool.ruff.lint]
|
|
113
|
+
select = [
|
|
114
|
+
"E", # pycodestyle errors
|
|
115
|
+
"W", # pycodestyle warnings
|
|
116
|
+
"F", # pyflakes
|
|
117
|
+
"I", # isort
|
|
118
|
+
"N", # pep8-naming
|
|
119
|
+
"UP", # pyupgrade
|
|
120
|
+
"B", # flake8-bugbear
|
|
121
|
+
"A", # flake8-builtins
|
|
122
|
+
"C4", # flake8-comprehensions
|
|
123
|
+
"DTZ", # flake8-datetimez
|
|
124
|
+
"T20", # flake8-print
|
|
125
|
+
"SIM", # flake8-simplify
|
|
126
|
+
"TC", # flake8-type-checking
|
|
127
|
+
"RUF", # ruff-specific rules
|
|
128
|
+
"D", # pydocstyle
|
|
129
|
+
"ANN", # flake8-annotations
|
|
130
|
+
"S", # flake8-bandit (security)
|
|
131
|
+
"PT", # flake8-pytest-style
|
|
132
|
+
]
|
|
133
|
+
ignore = [
|
|
134
|
+
"D100", # Missing docstring in public module (handled per-file)
|
|
135
|
+
"D104", # Missing docstring in public package
|
|
136
|
+
"D203", # 1 blank line before class docstring (conflicts with D211)
|
|
137
|
+
"D213", # Multi-line docstring summary on second line (conflicts with D212)
|
|
138
|
+
"ANN401", # Allow Any for JSON responses and kwargs passthrough
|
|
139
|
+
"S101", # Use of assert (needed in tests)
|
|
140
|
+
"TC001", # Move application import into TYPE_CHECKING block
|
|
141
|
+
"TC002", # Move third-party import into TYPE_CHECKING block
|
|
142
|
+
"TC003", # Move stdlib import into TYPE_CHECKING block
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
[tool.ruff.lint.per-file-ignores]
|
|
146
|
+
"tests/**/*.py" = [
|
|
147
|
+
"D", # No docstring requirements in tests
|
|
148
|
+
"ANN", # No annotation requirements in tests
|
|
149
|
+
"S101", # Allow assert in tests
|
|
150
|
+
"S105", # Allow hardcoded strings in tests
|
|
151
|
+
"S106", # Allow hardcoded passwords in tests
|
|
152
|
+
"S107", # Allow hardcoded passwords in test defaults
|
|
153
|
+
"T20", # Allow print in tests
|
|
154
|
+
]
|
|
155
|
+
"examples/**/*.py" = [
|
|
156
|
+
"D", # No docstring requirements in examples
|
|
157
|
+
"T20", # Allow print in examples
|
|
158
|
+
"ANN", # No annotation requirements in examples
|
|
159
|
+
]
|
|
160
|
+
"src/eveonline/const.py" = [
|
|
161
|
+
"S105", # SSO_TOKEN_URL is a URL, not a password
|
|
162
|
+
]
|
|
163
|
+
|
|
164
|
+
[tool.ruff.lint.pydocstyle]
|
|
165
|
+
convention = "google"
|
|
166
|
+
|
|
167
|
+
# -- pylint ------------------------------------------------------------------
|
|
168
|
+
[tool.pylint.main]
|
|
169
|
+
py-version = "3.11"
|
|
170
|
+
load-plugins = ["pylint.extensions.code_style"]
|
|
171
|
+
|
|
172
|
+
[tool.pylint.format]
|
|
173
|
+
max-line-length = 120
|
|
174
|
+
|
|
175
|
+
[tool.pylint."messages control"]
|
|
176
|
+
disable = [
|
|
177
|
+
"too-few-public-methods",
|
|
178
|
+
"too-many-instance-attributes",
|
|
179
|
+
"duplicate-code",
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
[tool.pylint.design]
|
|
183
|
+
max-args = 10
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Async Python client for the Eve Online ESI API."""
|
|
2
|
+
|
|
3
|
+
from .auth import AbstractAuth
|
|
4
|
+
from .client import EveOnlineClient
|
|
5
|
+
from .exceptions import (
|
|
6
|
+
EveOnlineAuthenticationError,
|
|
7
|
+
EveOnlineConnectionError,
|
|
8
|
+
EveOnlineError,
|
|
9
|
+
EveOnlineRateLimitError,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.0"
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"AbstractAuth",
|
|
16
|
+
"EveOnlineAuthenticationError",
|
|
17
|
+
"EveOnlineClient",
|
|
18
|
+
"EveOnlineConnectionError",
|
|
19
|
+
"EveOnlineError",
|
|
20
|
+
"EveOnlineRateLimitError",
|
|
21
|
+
"__version__",
|
|
22
|
+
]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Abstract authentication for the Eve Online ESI API."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from aiohttp import ClientResponse, ClientSession
|
|
9
|
+
|
|
10
|
+
from .const import ESI_BASE_URL
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class AbstractAuth(ABC):
|
|
14
|
+
"""Abstract class to make authenticated requests to the ESI API.
|
|
15
|
+
|
|
16
|
+
This follows the Home Assistant API library pattern where the library
|
|
17
|
+
provides an abstract auth class, and the integration (or standalone user)
|
|
18
|
+
provides a concrete implementation that handles token management.
|
|
19
|
+
|
|
20
|
+
Example usage::
|
|
21
|
+
|
|
22
|
+
class MyAuth(AbstractAuth):
|
|
23
|
+
async def async_get_access_token(self) -> str:
|
|
24
|
+
return self._my_token_manager.get_token()
|
|
25
|
+
|
|
26
|
+
auth = MyAuth(session)
|
|
27
|
+
client = EveOnlineClient(auth=auth)
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(
|
|
31
|
+
self,
|
|
32
|
+
websession: ClientSession,
|
|
33
|
+
host: str = ESI_BASE_URL,
|
|
34
|
+
) -> None:
|
|
35
|
+
"""Initialize the auth.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
websession: An aiohttp ClientSession for making requests.
|
|
39
|
+
host: The ESI API base URL. Defaults to the official ESI endpoint.
|
|
40
|
+
"""
|
|
41
|
+
self.websession = websession
|
|
42
|
+
self.host = host
|
|
43
|
+
|
|
44
|
+
@abstractmethod
|
|
45
|
+
async def async_get_access_token(self) -> str:
|
|
46
|
+
"""Return a valid access token for the ESI API."""
|
|
47
|
+
|
|
48
|
+
async def request(self, method: str, path: str, **kwargs: Any) -> ClientResponse:
|
|
49
|
+
"""Make an authenticated request to the ESI API.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
method: HTTP method (GET, POST, etc.).
|
|
53
|
+
path: API path (e.g., "characters/12345/wallet/").
|
|
54
|
+
**kwargs: Additional arguments passed to aiohttp request.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
The aiohttp ClientResponse.
|
|
58
|
+
"""
|
|
59
|
+
headers: dict[str, str] = dict(kwargs.pop("headers", {}) or {})
|
|
60
|
+
access_token = await self.async_get_access_token()
|
|
61
|
+
headers["authorization"] = f"Bearer {access_token}"
|
|
62
|
+
|
|
63
|
+
return await self.websession.request(
|
|
64
|
+
method,
|
|
65
|
+
f"{self.host}/{path}",
|
|
66
|
+
**kwargs,
|
|
67
|
+
headers=headers,
|
|
68
|
+
)
|