TornAPIWrapper 2.8.0__tar.gz → 2.9.1__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.
- {tornapiwrapper-2.8.0/src/TornAPIWrapper.egg-info → tornapiwrapper-2.9.1}/PKG-INFO +2 -2
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/README.md +1 -1
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/__init__.py +2 -2
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/client.py +7 -3
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/client_async.py +7 -3
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/company.py +30 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/company.py +30 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/params/map.py +1 -1
- tornapiwrapper-2.9.1/src/TornAPIWrapper/text_response_endpoints.py +1 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1/src/TornAPIWrapper.egg-info}/PKG-INFO +2 -2
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper.egg-info/SOURCES.txt +1 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/LICENSE +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/pyproject.toml +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/setup.cfg +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/__main__.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/__init__.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/faction.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/forum.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/key.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/market.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/property.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/racing.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/torn.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints/user.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/__init__.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/faction.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/forum.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/key.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/market.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/property.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/racing.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/torn.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/user.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/errors.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/params/__init__.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/params/builders.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/type_hints.py +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper.egg-info/dependency_links.txt +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper.egg-info/requires.txt +0 -0
- {tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: TornAPIWrapper
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.1
|
|
4
4
|
Summary: A Python wrapper for the Torn City API, providing access to Torn City data.
|
|
5
5
|
Author: cxdzc
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -53,7 +53,7 @@ Dynamic: license-file
|
|
|
53
53
|
<a href="https://pypi.org/project/TornAPIWrapper/"><img src=https://img.shields.io/pypi/v/tornapiwrapper?cacheSeconds=300></a>
|
|
54
54
|
<a href="https://pypi.org/project/TornAPIWrapper/"><img src=https://img.shields.io/pypi/pyversions/tornapiwrapper?cacheSeconds=300></a>
|
|
55
55
|
<a href="https://pypi.org/project/TornAPIWrapper/"><img src=https://img.shields.io/pepy/dt/tornapiwrapper?color=blue&cacheSeconds=300></a>
|
|
56
|
-
<a href="https://www.torn.com/api.html#:~:text=Patch%20Notes"><img src=https://img.shields.io/badge/patch-
|
|
56
|
+
<a href="https://www.torn.com/api.html#:~:text=Patch%20Notes"><img src=https://img.shields.io/badge/patch-01.06.2026-c4c4c4?cacheSeconds=300></a>
|
|
57
57
|
<a rel="license" href="https://github.com/cxdzc/TornAPIWrapper/blob/main/LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-ab1436"/></a>
|
|
58
58
|
</div>
|
|
59
59
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<a href="https://pypi.org/project/TornAPIWrapper/"><img src=https://img.shields.io/pypi/v/tornapiwrapper?cacheSeconds=300></a>
|
|
7
7
|
<a href="https://pypi.org/project/TornAPIWrapper/"><img src=https://img.shields.io/pypi/pyversions/tornapiwrapper?cacheSeconds=300></a>
|
|
8
8
|
<a href="https://pypi.org/project/TornAPIWrapper/"><img src=https://img.shields.io/pepy/dt/tornapiwrapper?color=blue&cacheSeconds=300></a>
|
|
9
|
-
<a href="https://www.torn.com/api.html#:~:text=Patch%20Notes"><img src=https://img.shields.io/badge/patch-
|
|
9
|
+
<a href="https://www.torn.com/api.html#:~:text=Patch%20Notes"><img src=https://img.shields.io/badge/patch-01.06.2026-c4c4c4?cacheSeconds=300></a>
|
|
10
10
|
<a rel="license" href="https://github.com/cxdzc/TornAPIWrapper/blob/main/LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-ab1436"/></a>
|
|
11
11
|
</div>
|
|
12
12
|
|
|
@@ -26,8 +26,8 @@ __author__ = "cxdzc"
|
|
|
26
26
|
__copyright__ = "Copyright 2023-Present cxdzc"
|
|
27
27
|
__license__ = "MIT"
|
|
28
28
|
__title__ = "TornAPIWrapper"
|
|
29
|
-
__version__ = "2.
|
|
30
|
-
__patch__ = "
|
|
29
|
+
__version__ = "2.9.1"
|
|
30
|
+
__patch__ = "01.06.2026"
|
|
31
31
|
|
|
32
32
|
from .errors import (
|
|
33
33
|
WrapperError,
|
|
@@ -35,6 +35,8 @@ from .endpoints.racing import Racing
|
|
|
35
35
|
from .endpoints.torn import Torn
|
|
36
36
|
from .endpoints.user import User
|
|
37
37
|
from .errors import TornAPIErrorHandler
|
|
38
|
+
from .text_response_endpoints import text_response_endpoints
|
|
39
|
+
|
|
38
40
|
|
|
39
41
|
class TornAPIWrapper:
|
|
40
42
|
"""
|
|
@@ -59,16 +61,18 @@ class TornAPIWrapper:
|
|
|
59
61
|
self.key: Key = Key(self)
|
|
60
62
|
self.torn: Torn = Torn(self)
|
|
61
63
|
|
|
62
|
-
def request(self, endpoint: str, params: dict | None) -> dict:
|
|
64
|
+
def request(self, endpoint: str, params: dict | None) -> dict | str:
|
|
63
65
|
"""
|
|
64
|
-
Sends a request to the Torn API and returns
|
|
66
|
+
Sends a request to the Torn API and returns either JSON data or raw text.
|
|
65
67
|
:param endpoint: Torn API endpoint path.
|
|
66
68
|
:param params: Query parameters to include in the request.
|
|
67
69
|
:return: API response data.
|
|
68
|
-
:rtype: dict
|
|
70
|
+
:rtype: dict | str
|
|
69
71
|
"""
|
|
70
72
|
api_request = self.session.get(url=f"{self.BASE_URL}{endpoint}", params=params, timeout=self.request_timeout)
|
|
71
73
|
api_request.raise_for_status()
|
|
74
|
+
if endpoint in text_response_endpoints:
|
|
75
|
+
return api_request.text
|
|
72
76
|
api_request_json = api_request.json()
|
|
73
77
|
api_request_error = api_request_json.get("error")
|
|
74
78
|
if api_request_error:
|
|
@@ -35,6 +35,8 @@ from .endpoints_async.racing import Racing
|
|
|
35
35
|
from .endpoints_async.torn import Torn
|
|
36
36
|
from .endpoints_async.user import User
|
|
37
37
|
from .errors import TornAPIErrorHandler
|
|
38
|
+
from .text_response_endpoints import text_response_endpoints
|
|
39
|
+
|
|
38
40
|
|
|
39
41
|
class TornAPIWrapperAsync:
|
|
40
42
|
"""
|
|
@@ -65,16 +67,18 @@ class TornAPIWrapperAsync:
|
|
|
65
67
|
self.key: Key = Key(self)
|
|
66
68
|
self.torn: Torn = Torn(self)
|
|
67
69
|
|
|
68
|
-
async def request(self, endpoint: str, params: dict | None) -> dict:
|
|
70
|
+
async def request(self, endpoint: str, params: dict | None) -> dict | str:
|
|
69
71
|
"""
|
|
70
|
-
Sends a request to the Torn API and returns
|
|
72
|
+
Sends a request to the Torn API and returns either JSON data or raw text.
|
|
71
73
|
:param endpoint: Torn API endpoint path.
|
|
72
74
|
:param params: Query parameters to include in the request.
|
|
73
75
|
:return: API response data.
|
|
74
|
-
:rtype: dict
|
|
76
|
+
:rtype: dict | str
|
|
75
77
|
"""
|
|
76
78
|
async with self.session.get(url=f"{self.BASE_URL}{endpoint}", params=params) as api_request:
|
|
77
79
|
api_request.raise_for_status()
|
|
80
|
+
if endpoint in text_response_endpoints:
|
|
81
|
+
return await api_request.text()
|
|
78
82
|
api_request_json = await api_request.json()
|
|
79
83
|
api_request_error = api_request_json.get("error")
|
|
80
84
|
if api_request_error:
|
|
@@ -111,6 +111,36 @@ class Company:
|
|
|
111
111
|
"""
|
|
112
112
|
return self.api.request("/company/profile", build_params(self.get_profile, locals()))
|
|
113
113
|
|
|
114
|
+
def get_search(self, company_name: str = None, filters: list[str] = None, limit: int = 20, offset: int = 0, timestamp: int = None, comment: str = None) -> dict: #1F4A9 endpoint
|
|
115
|
+
"""
|
|
116
|
+
Search companies by name or other criteria.
|
|
117
|
+
API key (Public).
|
|
118
|
+
This selection is standalone and cannot be used together with other selections.
|
|
119
|
+
:param company_name: Name to search for.
|
|
120
|
+
:param filters: A filtering query parameter allowing a comma-separated list of filters.
|
|
121
|
+
:param limit: Number of results to return.
|
|
122
|
+
:param offset: Number of rows to skip before returning results.
|
|
123
|
+
:param timestamp: Timestamp to bypass cache or get the data in specific point in time.
|
|
124
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
125
|
+
:return: API response data.
|
|
126
|
+
:rtype: dict
|
|
127
|
+
"""
|
|
128
|
+
return self.api.request("/company/search", build_params(self.get_search, locals()))
|
|
129
|
+
|
|
130
|
+
def get_snapshot(self, timestamp: int = None, comment: str = None):
|
|
131
|
+
"""
|
|
132
|
+
Get daily companies snapshot CSV.
|
|
133
|
+
API key (Public).
|
|
134
|
+
Returns a CSV daily snapshot of companies.
|
|
135
|
+
This selection is standalone and cannot be used together with other selections.
|
|
136
|
+
CSV columns: id, name, created_at, days_old, image, type, rating, director_id, employees_hired, employees_capacity, daily_income, daily_customers, weekly_income, weekly_customers, applications_allowed
|
|
137
|
+
:param timestamp: Timestamp to bypass cache or get the data in specific point in time.
|
|
138
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
139
|
+
:return: API response data.
|
|
140
|
+
:rtype: dict
|
|
141
|
+
"""
|
|
142
|
+
return self.api.request("/company/snapshot", build_params(self.get_snapshot, locals()))
|
|
143
|
+
|
|
114
144
|
def get_stock(self, timestamp: int = None, comment: str = None):
|
|
115
145
|
"""
|
|
116
146
|
Get your company's stock.
|
|
@@ -111,6 +111,36 @@ class Company:
|
|
|
111
111
|
"""
|
|
112
112
|
return await self.api.request("/company/profile", build_params(self.get_profile, locals()))
|
|
113
113
|
|
|
114
|
+
async def get_search(self, company_name: str = None, filters: list[str] = None, limit: int = 20, offset: int = 0, timestamp: int = None, comment: str = None) -> dict: #1F4A9 endpoint
|
|
115
|
+
"""
|
|
116
|
+
Search companies by name or other criteria.
|
|
117
|
+
API key (Public).
|
|
118
|
+
This selection is standalone and cannot be used together with other selections.
|
|
119
|
+
:param company_name: Name to search for.
|
|
120
|
+
:param filters: A filtering query parameter allowing a comma-separated list of filters.
|
|
121
|
+
:param limit: Number of results to return.
|
|
122
|
+
:param offset: Number of rows to skip before returning results.
|
|
123
|
+
:param timestamp: Timestamp to bypass cache or get the data in specific point in time.
|
|
124
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
125
|
+
:return: API response data.
|
|
126
|
+
:rtype: dict
|
|
127
|
+
"""
|
|
128
|
+
return await self.api.request("/company/search", build_params(self.get_search, locals()))
|
|
129
|
+
|
|
130
|
+
async def get_snapshot(self, timestamp: int = None, comment: str = None):
|
|
131
|
+
"""
|
|
132
|
+
Get daily companies snapshot CSV.
|
|
133
|
+
API key (Public).
|
|
134
|
+
Returns a CSV daily snapshot of companies.
|
|
135
|
+
This selection is standalone and cannot be used together with other selections.
|
|
136
|
+
CSV columns: id, name, created_at, days_old, image, type, rating, director_id, employees_hired, employees_capacity, daily_income, daily_customers, weekly_income, weekly_customers, applications_allowed
|
|
137
|
+
:param timestamp: Timestamp to bypass cache or get the data in specific point in time.
|
|
138
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
139
|
+
:return: API response data.
|
|
140
|
+
:rtype: dict
|
|
141
|
+
"""
|
|
142
|
+
return await self.api.request("/company/snapshot", build_params(self.get_snapshot, locals()))
|
|
143
|
+
|
|
114
144
|
async def get_stock(self, timestamp: int = None, comment: str = None):
|
|
115
145
|
"""
|
|
116
146
|
Get your company's stock.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
param_from = {"from_"}
|
|
2
2
|
param_target = {"target_id"}
|
|
3
|
-
param_name = {"faction_name"}
|
|
3
|
+
param_name = {"company_name", "faction_name"}
|
|
4
4
|
param_stat = {"stat_key", "stat_keys"}
|
|
5
5
|
param_log = {"attack_log_id", "log_id"}
|
|
6
6
|
param_ids = {"category_ids", "honor_ids", "item_ids", "medals_ids", "territory_ids"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
text_response_endpoints = {"/company/snapshot"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: TornAPIWrapper
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.1
|
|
4
4
|
Summary: A Python wrapper for the Torn City API, providing access to Torn City data.
|
|
5
5
|
Author: cxdzc
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -53,7 +53,7 @@ Dynamic: license-file
|
|
|
53
53
|
<a href="https://pypi.org/project/TornAPIWrapper/"><img src=https://img.shields.io/pypi/v/tornapiwrapper?cacheSeconds=300></a>
|
|
54
54
|
<a href="https://pypi.org/project/TornAPIWrapper/"><img src=https://img.shields.io/pypi/pyversions/tornapiwrapper?cacheSeconds=300></a>
|
|
55
55
|
<a href="https://pypi.org/project/TornAPIWrapper/"><img src=https://img.shields.io/pepy/dt/tornapiwrapper?color=blue&cacheSeconds=300></a>
|
|
56
|
-
<a href="https://www.torn.com/api.html#:~:text=Patch%20Notes"><img src=https://img.shields.io/badge/patch-
|
|
56
|
+
<a href="https://www.torn.com/api.html#:~:text=Patch%20Notes"><img src=https://img.shields.io/badge/patch-01.06.2026-c4c4c4?cacheSeconds=300></a>
|
|
57
57
|
<a rel="license" href="https://github.com/cxdzc/TornAPIWrapper/blob/main/LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-ab1436"/></a>
|
|
58
58
|
</div>
|
|
59
59
|
|
|
@@ -6,6 +6,7 @@ src/TornAPIWrapper/__main__.py
|
|
|
6
6
|
src/TornAPIWrapper/client.py
|
|
7
7
|
src/TornAPIWrapper/client_async.py
|
|
8
8
|
src/TornAPIWrapper/errors.py
|
|
9
|
+
src/TornAPIWrapper/text_response_endpoints.py
|
|
9
10
|
src/TornAPIWrapper/type_hints.py
|
|
10
11
|
src/TornAPIWrapper.egg-info/PKG-INFO
|
|
11
12
|
src/TornAPIWrapper.egg-info/SOURCES.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper/endpoints_async/property.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tornapiwrapper-2.8.0 → tornapiwrapper-2.9.1}/src/TornAPIWrapper.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|