TornAPIWrapper 2.16.0__tar.gz → 2.18.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.
- {tornapiwrapper-2.16.0/src/TornAPIWrapper.egg-info → tornapiwrapper-2.18.0}/PKG-INFO +2 -2
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/README.md +1 -1
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/__init__.py +6 -4
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/client.py +1 -2
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/client_async.py +1 -2
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/torn.py +49 -3
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/user.py +12 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/torn.py +49 -3
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/user.py +12 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/errors.py +8 -2
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0/src/TornAPIWrapper.egg-info}/PKG-INFO +2 -2
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper.egg-info/SOURCES.txt +0 -1
- tornapiwrapper-2.16.0/src/TornAPIWrapper/text_response_endpoints.py +0 -1
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/LICENSE +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/pyproject.toml +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/setup.cfg +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/__main__.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/__init__.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/company.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/faction.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/forum.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/key.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/market.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/property.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints/racing.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/__init__.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/company.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/faction.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/forum.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/key.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/market.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/property.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/racing.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/params/__init__.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/params/builders.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/params/map.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/type_hints.py +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper.egg-info/dependency_links.txt +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper.egg-info/requires.txt +0 -0
- {tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/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.18.0
|
|
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-27.10.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-27.10.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,9 +26,11 @@ __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.18.0"
|
|
30
|
+
__patch__ = "27.10.2026"
|
|
31
31
|
|
|
32
|
+
from .client import TornAPIWrapper
|
|
33
|
+
from .client_async import TornAPIWrapperAsync
|
|
32
34
|
from .errors import (
|
|
33
35
|
WrapperError,
|
|
34
36
|
UnhandledAPIError,
|
|
@@ -63,9 +65,8 @@ from .errors import (
|
|
|
63
65
|
MigrationRequiredOC2,
|
|
64
66
|
InvalidLogId,
|
|
65
67
|
InvalidInteractionLogCategory,
|
|
68
|
+
FileDoesNotExist,
|
|
66
69
|
)
|
|
67
|
-
from .client import TornAPIWrapper
|
|
68
|
-
from .client_async import TornAPIWrapperAsync
|
|
69
70
|
|
|
70
71
|
__all__ = [
|
|
71
72
|
"TornAPIWrapper",
|
|
@@ -105,4 +106,5 @@ __all__ = [
|
|
|
105
106
|
"MigrationRequiredOC2",
|
|
106
107
|
"InvalidLogId",
|
|
107
108
|
"InvalidInteractionLogCategory",
|
|
109
|
+
"FileDoesNotExist",
|
|
108
110
|
]
|
|
@@ -35,7 +35,6 @@ 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
40
|
class TornAPIWrapper:
|
|
@@ -71,7 +70,7 @@ class TornAPIWrapper:
|
|
|
71
70
|
"""
|
|
72
71
|
api_request = self.session.get(url=f"{self.BASE_URL}{endpoint}", params=params, timeout=self.request_timeout)
|
|
73
72
|
api_request.raise_for_status()
|
|
74
|
-
if
|
|
73
|
+
if api_request.headers.get("Content-Type", None) == "text/csv":
|
|
75
74
|
return api_request.text
|
|
76
75
|
api_request_json = api_request.json()
|
|
77
76
|
api_request_error = api_request_json.get("error")
|
|
@@ -35,7 +35,6 @@ 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
40
|
class TornAPIWrapperAsync:
|
|
@@ -77,7 +76,7 @@ class TornAPIWrapperAsync:
|
|
|
77
76
|
"""
|
|
78
77
|
async with self.session.get(url=f"{self.BASE_URL}{endpoint}", params=params) as api_request:
|
|
79
78
|
api_request.raise_for_status()
|
|
80
|
-
if
|
|
79
|
+
if api_request.headers.get("Content-Type", None) == "text/csv":
|
|
81
80
|
return await api_request.text()
|
|
82
81
|
api_request_json = await api_request.json()
|
|
83
82
|
api_request_error = api_request_json.get("error")
|
|
@@ -207,6 +207,18 @@ class Torn:
|
|
|
207
207
|
"""
|
|
208
208
|
return self.api.request("/torn/gyms", build_params(self.get_gyms, locals()))
|
|
209
209
|
|
|
210
|
+
def get_halloween(self, timestamp: int = None, comment: str = None) -> dict:
|
|
211
|
+
"""
|
|
212
|
+
Get Halloween basket upgrades.
|
|
213
|
+
API key (Minimal).
|
|
214
|
+
Returns the list of available Halloween basket upgrades with their benefits, treats cost and unlock requirement.
|
|
215
|
+
:param timestamp: Timestamp to bypass cache.
|
|
216
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
217
|
+
:return: API response data.
|
|
218
|
+
:rtype: dict
|
|
219
|
+
"""
|
|
220
|
+
return self.api.request("/torn/halloween", build_params(self.get_halloween, locals()))
|
|
221
|
+
|
|
210
222
|
def get_honors(self, honor_ids: list[int] = None, limit: int = 20, offset: int = 0, sort: SortOptions = None, timestamp: int = None, comment: str = None) -> dict:
|
|
211
223
|
"""
|
|
212
224
|
Get all honors or specific honors.
|
|
@@ -247,11 +259,11 @@ class Torn:
|
|
|
247
259
|
"""
|
|
248
260
|
return self.api.request("/torn/itemammo", build_params(self.get_itemammo, locals()))
|
|
249
261
|
|
|
250
|
-
def get_itemdetails(self,
|
|
262
|
+
def get_itemdetails(self, item_ids: list[int], timestamp: int = None, comment: str = None) -> dict:
|
|
251
263
|
"""
|
|
252
|
-
Get
|
|
264
|
+
Get details for specific item(s).
|
|
253
265
|
API key (Public).
|
|
254
|
-
:param
|
|
266
|
+
:param item_ids: Item uid or a list of item uids (comma separated), 25 uids maximum.
|
|
255
267
|
:param timestamp: Timestamp to bypass cache.
|
|
256
268
|
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
257
269
|
:return: API response data.
|
|
@@ -270,6 +282,18 @@ class Torn:
|
|
|
270
282
|
"""
|
|
271
283
|
return self.api.request("/torn/itemmods", build_params(self.get_itemmods, locals()))
|
|
272
284
|
|
|
285
|
+
def get_itemstats(self, item_ids: list[int], timestamp: int = None, comment: str = None) -> dict:
|
|
286
|
+
"""
|
|
287
|
+
Get specific item(s) stats.
|
|
288
|
+
API key (Public).
|
|
289
|
+
:param item_ids: Item uid or a list of item uids (comma separated), 25 uids maximum.
|
|
290
|
+
:param timestamp: Timestamp to bypass cache.
|
|
291
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
292
|
+
:return: API response data.
|
|
293
|
+
:rtype: dict
|
|
294
|
+
"""
|
|
295
|
+
return self.api.request("/torn/itemstats", build_params(self.get_itemstats, locals()))
|
|
296
|
+
|
|
273
297
|
def get_items(self, item_ids: list[int] = None, item_category: TornItemsCatOptions = None, sort: SortOptions = "ASC", timestamp: int = None, comment: str = None) -> dict:
|
|
274
298
|
"""
|
|
275
299
|
Get information about items.
|
|
@@ -378,6 +402,17 @@ class Torn:
|
|
|
378
402
|
"""
|
|
379
403
|
return self.api.request("/torn/properties", build_params(self.get_properties, locals()))
|
|
380
404
|
|
|
405
|
+
def get_rockpaperscissors(self, timestamp: int = None, comment: str = None) -> dict:
|
|
406
|
+
"""
|
|
407
|
+
Get rock paper scissors competition stats.
|
|
408
|
+
API key (Public).
|
|
409
|
+
:param timestamp: Timestamp to bypass cache.
|
|
410
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
411
|
+
:return: API response data.
|
|
412
|
+
:rtype: dict
|
|
413
|
+
"""
|
|
414
|
+
return self.api.request("/torn/rockpaperscissors", build_params(self.get_rockpaperscissors, locals()))
|
|
415
|
+
|
|
381
416
|
def get_searchforcash(self, timestamp: int = None, comment: str = None) -> dict:
|
|
382
417
|
"""
|
|
383
418
|
Get search for cash crime statuses.
|
|
@@ -400,6 +435,17 @@ class Torn:
|
|
|
400
435
|
"""
|
|
401
436
|
return self.api.request("/torn/shoplifting", build_params(self.get_shoplifting, locals()))
|
|
402
437
|
|
|
438
|
+
def get_stats(self, timestamp: int = None, comment: str = None) -> dict:
|
|
439
|
+
"""
|
|
440
|
+
Get daily city stats.
|
|
441
|
+
API key (Public).
|
|
442
|
+
:param timestamp: Timestamp to bypass cache.
|
|
443
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
444
|
+
:return: API response data.
|
|
445
|
+
:rtype: dict
|
|
446
|
+
"""
|
|
447
|
+
return self.api.request("/torn/stats", build_params(self.get_stats, locals()))
|
|
448
|
+
|
|
403
449
|
def get_stocks(self, stock_id: int = None, timestamp: int = None, comment: str = None) -> dict:
|
|
404
450
|
"""
|
|
405
451
|
Get all stocks or specific stock with chart history.
|
|
@@ -350,6 +350,18 @@ class User:
|
|
|
350
350
|
"""
|
|
351
351
|
return self.api.request("/user/gym", build_params(self.get_gym, locals()))
|
|
352
352
|
|
|
353
|
+
def get_halloween(self, timestamp: int = None, comment: str = None) -> dict:
|
|
354
|
+
"""
|
|
355
|
+
Get your Halloween treats information.
|
|
356
|
+
API key (Minimal).
|
|
357
|
+
Returns your current and cumulative treats and the IDs of basket upgrades you have unlocked.
|
|
358
|
+
:param timestamp: Timestamp to bypass cache.
|
|
359
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
360
|
+
:return: API response data.
|
|
361
|
+
:rtype: dict
|
|
362
|
+
"""
|
|
363
|
+
return self.api.request("/user/halloween", build_params(self.get_gym, locals()))
|
|
364
|
+
|
|
353
365
|
def get_hof(self, user_id: int = None, timestamp: int = None, comment: str = None) -> dict:
|
|
354
366
|
"""
|
|
355
367
|
Get your hall of fame rankings or for a specific player.
|
|
@@ -207,6 +207,18 @@ class Torn:
|
|
|
207
207
|
"""
|
|
208
208
|
return await self.api.request("/torn/gyms", build_params(self.get_gyms, locals()))
|
|
209
209
|
|
|
210
|
+
async def get_halloween(self, timestamp: int = None, comment: str = None) -> dict:
|
|
211
|
+
"""
|
|
212
|
+
Get Halloween basket upgrades.
|
|
213
|
+
API key (Minimal).
|
|
214
|
+
Returns the list of available Halloween basket upgrades with their benefits, treats cost and unlock requirement.
|
|
215
|
+
:param timestamp: Timestamp to bypass cache.
|
|
216
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
217
|
+
:return: API response data.
|
|
218
|
+
:rtype: dict
|
|
219
|
+
"""
|
|
220
|
+
return await self.api.request("/torn/halloween", build_params(self.get_halloween, locals()))
|
|
221
|
+
|
|
210
222
|
async def get_honors(self, honor_ids: list[int] = None, limit: int = 20, offset: int = 0, sort: SortOptions = None, timestamp: int = None, comment: str = None) -> dict:
|
|
211
223
|
"""
|
|
212
224
|
Get all honors or specific honors.
|
|
@@ -247,11 +259,11 @@ class Torn:
|
|
|
247
259
|
"""
|
|
248
260
|
return await self.api.request("/torn/itemammo", build_params(self.get_itemammo, locals()))
|
|
249
261
|
|
|
250
|
-
async def get_itemdetails(self,
|
|
262
|
+
async def get_itemdetails(self, item_ids: list[int], timestamp: int = None, comment: str = None) -> dict:
|
|
251
263
|
"""
|
|
252
|
-
Get
|
|
264
|
+
Get details for specific item(s).
|
|
253
265
|
API key (Public).
|
|
254
|
-
:param
|
|
266
|
+
:param item_ids: Item uid or a list of item uids (comma separated), 25 uids maximum.
|
|
255
267
|
:param timestamp: Timestamp to bypass cache.
|
|
256
268
|
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
257
269
|
:return: API response data.
|
|
@@ -270,6 +282,18 @@ class Torn:
|
|
|
270
282
|
"""
|
|
271
283
|
return await self.api.request("/torn/itemmods", build_params(self.get_itemmods, locals()))
|
|
272
284
|
|
|
285
|
+
async def get_itemstats(self, item_ids: list[int], timestamp: int = None, comment: str = None) -> dict:
|
|
286
|
+
"""
|
|
287
|
+
Get specific item(s) stats.
|
|
288
|
+
API key (Public).
|
|
289
|
+
:param item_ids: Item uid or a list of item uids (comma separated), 25 uids maximum.
|
|
290
|
+
:param timestamp: Timestamp to bypass cache.
|
|
291
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
292
|
+
:return: API response data.
|
|
293
|
+
:rtype: dict
|
|
294
|
+
"""
|
|
295
|
+
return await self.api.request("/torn/itemstats", build_params(self.get_itemstats, locals()))
|
|
296
|
+
|
|
273
297
|
async def get_items(self, item_ids: list[int] = None, item_category: TornItemsCatOptions = None, sort: SortOptions = "ASC", timestamp: int = None, comment: str = None) -> dict:
|
|
274
298
|
"""
|
|
275
299
|
Get information about items.
|
|
@@ -378,6 +402,17 @@ class Torn:
|
|
|
378
402
|
"""
|
|
379
403
|
return await self.api.request("/torn/properties", build_params(self.get_properties, locals()))
|
|
380
404
|
|
|
405
|
+
async def get_rockpaperscissors(self, timestamp: int = None, comment: str = None) -> dict:
|
|
406
|
+
"""
|
|
407
|
+
Get rock paper scissors competition stats.
|
|
408
|
+
API key (Public).
|
|
409
|
+
:param timestamp: Timestamp to bypass cache.
|
|
410
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
411
|
+
:return: API response data.
|
|
412
|
+
:rtype: dict
|
|
413
|
+
"""
|
|
414
|
+
return await self.api.request("/torn/rockpaperscissors", build_params(self.get_rockpaperscissors, locals()))
|
|
415
|
+
|
|
381
416
|
async def get_searchforcash(self, timestamp: int = None, comment: str = None) -> dict:
|
|
382
417
|
"""
|
|
383
418
|
Get search for cash crime statuses.
|
|
@@ -400,6 +435,17 @@ class Torn:
|
|
|
400
435
|
"""
|
|
401
436
|
return await self.api.request("/torn/shoplifting", build_params(self.get_shoplifting, locals()))
|
|
402
437
|
|
|
438
|
+
async def get_stats(self, timestamp: int = None, comment: str = None) -> dict:
|
|
439
|
+
"""
|
|
440
|
+
Get daily city stats.
|
|
441
|
+
API key (Public).
|
|
442
|
+
:param timestamp: Timestamp to bypass cache.
|
|
443
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
444
|
+
:return: API response data.
|
|
445
|
+
:rtype: dict
|
|
446
|
+
"""
|
|
447
|
+
return await self.api.request("/torn/stats", build_params(self.get_stats, locals()))
|
|
448
|
+
|
|
403
449
|
async def get_stocks(self, stock_id: int = None, timestamp: int = None, comment: str = None) -> dict:
|
|
404
450
|
"""
|
|
405
451
|
Get all stocks or specific stock with chart history.
|
|
@@ -350,6 +350,18 @@ class User:
|
|
|
350
350
|
"""
|
|
351
351
|
return await self.api.request("/user/gym", build_params(self.get_gym, locals()))
|
|
352
352
|
|
|
353
|
+
async def get_halloween(self, timestamp: int = None, comment: str = None) -> dict:
|
|
354
|
+
"""
|
|
355
|
+
Get your Halloween treats information.
|
|
356
|
+
API key (Minimal).
|
|
357
|
+
Returns your current and cumulative treats and the IDs of basket upgrades you have unlocked.
|
|
358
|
+
:param timestamp: Timestamp to bypass cache.
|
|
359
|
+
:param comment: Comment for your tool/service/bot/website to be visible in the logs.
|
|
360
|
+
:return: API response data.
|
|
361
|
+
:rtype: dict
|
|
362
|
+
"""
|
|
363
|
+
return await self.api.request("/user/halloween", build_params(self.get_gym, locals()))
|
|
364
|
+
|
|
353
365
|
async def get_hof(self, user_id: int = None, timestamp: int = None, comment: str = None) -> dict:
|
|
354
366
|
"""
|
|
355
367
|
Get your hall of fame rankings or for a specific player.
|
|
@@ -260,7 +260,6 @@ class MigrationRequiredOC2(APIError):
|
|
|
260
260
|
"""
|
|
261
261
|
pass
|
|
262
262
|
|
|
263
|
-
|
|
264
263
|
class InvalidLogId(APIError):
|
|
265
264
|
"""
|
|
266
265
|
28
|
|
@@ -268,7 +267,6 @@ class InvalidLogId(APIError):
|
|
|
268
267
|
"""
|
|
269
268
|
pass
|
|
270
269
|
|
|
271
|
-
|
|
272
270
|
class InvalidInteractionLogCategory(APIError):
|
|
273
271
|
"""
|
|
274
272
|
29
|
|
@@ -276,6 +274,13 @@ class InvalidInteractionLogCategory(APIError):
|
|
|
276
274
|
"""
|
|
277
275
|
pass
|
|
278
276
|
|
|
277
|
+
class FileDoesNotExist(APIError):
|
|
278
|
+
"""
|
|
279
|
+
30
|
|
280
|
+
File does not exist.
|
|
281
|
+
"""
|
|
282
|
+
pass
|
|
283
|
+
|
|
279
284
|
class TornAPIErrorHandler:
|
|
280
285
|
"""
|
|
281
286
|
Handle Torn API error codes and raise appropriate exceptions.
|
|
@@ -311,6 +316,7 @@ class TornAPIErrorHandler:
|
|
|
311
316
|
27: (MigrationRequiredOC2, "Must be migrated to organized crimes 2.0."),
|
|
312
317
|
28: (InvalidLogId, "Incorrect log ID."),
|
|
313
318
|
29: (InvalidInteractionLogCategory, "Category selection is not available for interaction logs."),
|
|
319
|
+
30: (FileDoesNotExist, "File does not exist."),
|
|
314
320
|
}
|
|
315
321
|
|
|
316
322
|
def raise_code(self, error_code: int):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: TornAPIWrapper
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.18.0
|
|
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-27.10.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,6 @@ 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
|
|
10
9
|
src/TornAPIWrapper/type_hints.py
|
|
11
10
|
src/TornAPIWrapper.egg-info/PKG-INFO
|
|
12
11
|
src/TornAPIWrapper.egg-info/SOURCES.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
text_response_endpoints = {"/user/snapshot", "/faction/snapshot", "/company/snapshot"}
|
|
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.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/__init__.py
RENAMED
|
File without changes
|
{tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/company.py
RENAMED
|
File without changes
|
{tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/faction.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/market.py
RENAMED
|
File without changes
|
{tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/property.py
RENAMED
|
File without changes
|
{tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper/endpoints_async/racing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tornapiwrapper-2.16.0 → tornapiwrapper-2.18.0}/src/TornAPIWrapper.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|