TornAPIWrapper 2.2.0__tar.gz → 2.3.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.
Files changed (37) hide show
  1. {tornapiwrapper-2.2.0/src/TornAPIWrapper.egg-info → tornapiwrapper-2.3.1}/PKG-INFO +2 -2
  2. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/README.md +2 -2
  3. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/__init__.py +2 -2
  4. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints/faction.py +4 -2
  5. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints/user.py +34 -1
  6. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints_async/faction.py +4 -2
  7. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints_async/user.py +34 -1
  8. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/params/map.py +2 -0
  9. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/type_hints.py +1 -0
  10. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1/src/TornAPIWrapper.egg-info}/PKG-INFO +2 -2
  11. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/LICENSE +0 -0
  12. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/pyproject.toml +0 -0
  13. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/setup.cfg +0 -0
  14. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/__main__.py +0 -0
  15. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/client.py +0 -0
  16. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/client_async.py +0 -0
  17. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints/__init__.py +0 -0
  18. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints/forum.py +0 -0
  19. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints/key.py +0 -0
  20. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints/market.py +0 -0
  21. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints/property.py +0 -0
  22. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints/racing.py +0 -0
  23. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints/torn.py +0 -0
  24. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints_async/__init__.py +0 -0
  25. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints_async/forum.py +0 -0
  26. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints_async/key.py +0 -0
  27. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints_async/market.py +0 -0
  28. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints_async/property.py +0 -0
  29. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints_async/racing.py +0 -0
  30. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/endpoints_async/torn.py +0 -0
  31. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/errors.py +0 -0
  32. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/params/__init__.py +0 -0
  33. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper/params/builders.py +0 -0
  34. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper.egg-info/SOURCES.txt +0 -0
  35. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper.egg-info/dependency_links.txt +0 -0
  36. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.1}/src/TornAPIWrapper.egg-info/requires.txt +0 -0
  37. {tornapiwrapper-2.2.0 → tornapiwrapper-2.3.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.2.0
3
+ Version: 2.3.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-23.02.2026-c4c4c4?cacheSeconds=300></a>
56
+ <a href="https://www.torn.com/api.html#:~:text=Patch%20Notes"><img src=https://img.shields.io/badge/patch-10.03.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-23.02.2026-c4c4c4?cacheSeconds=300></a>
9
+ <a href="https://www.torn.com/api.html#:~:text=Patch%20Notes"><img src=https://img.shields.io/badge/patch-10.03.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
 
@@ -43,4 +43,4 @@ View [CONTRIBUTING.md](https://github.com/cxdzc/TornAPIWrapper?tab=contributing-
43
43
  > [!NOTE]
44
44
  > This is not legal advice.
45
45
 
46
- The content and software in this repository are licensed under the [MIT License](https://github.com/cxdzc/TornAPIWrapper?tab=MIT-1-ov-file), a simple and permissive license that allows use, modification, and distribution as long as the license notice is preserved.
46
+ The content and software in this repository are licensed under the [MIT License](https://github.com/cxdzc/TornAPIWrapper?tab=MIT-1-ov-file), a simple and permissive license that allows use, modification, and distribution as long as the license notice is preserved.
@@ -26,8 +26,8 @@ __author__ = "cxdzc"
26
26
  __copyright__ = "Copyright 2023-Present cxdzc"
27
27
  __license__ = "MIT"
28
28
  __title__ = "TornAPIWrapper"
29
- __version__ = "2.2.0"
30
- __patch__ = "23.02.2026"
29
+ __version__ = "2.3.1"
30
+ __patch__ = "10.03.2026"
31
31
 
32
32
  from .errors import (
33
33
  WrapperError,
@@ -170,7 +170,7 @@ class Faction:
170
170
  """
171
171
  return self.api.request("/faction/contributors", build_params(self.get_contributors, locals()))
172
172
 
173
- def get_crimes(self, crimes_category: FacCrimesCatOptions = "all", crimes_filter: FacCrimesFiltersOptions = None, offset: int = 0, sort: SortOptions = "DESC", to: int = None, from_: int = None, timestamp: int = None, comment: str = None) -> dict:
173
+ def get_crimes(self, crimes_category: FacCrimesCatOptions = "all", crimes_filter: FacCrimesFiltersOptions = None, limit: int = 20, offset: int = 0, sort: SortOptions = "DESC", to: int = None, from_: int = None, timestamp: int = None, comment: str = None) -> dict:
174
174
  """
175
175
  Get your faction's organized crimes.
176
176
  Requires faction API access permissions.
@@ -183,6 +183,7 @@ class Faction:
183
183
  - For category 'planning', the ordering field is 'ready_at'.
184
184
  :param crimes_category: Category of organized crimes returned. Category 'available' includes both 'recruiting' & 'planning', and category 'completed' includes both 'successful' & 'failure'.
185
185
  :param crimes_filter: It's possible to set this parameter to specify a field used for the sort, from & to query parameters. If not specified, the field will default to the category sorting as described above.
186
+ :param limit: Number of results to return.
186
187
  :param offset: Number of rows to skip before returning results.
187
188
  :param sort: Sorted by the greatest timestamps.
188
189
  :param to: Timestamp that sets the upper limit for the data returned. Data returned will be up to and including this time.
@@ -335,7 +336,8 @@ class Faction:
335
336
  """
336
337
  Get faction reports.
337
338
  API key (Limited).
338
- The default limit is set to 25. However, the limit can be set to 100 for the 'stats' category.
339
+ The limit is set to 25 when requesting any category other than 'stats'.
340
+ When requesting the 'stats' category, limit can be increased up to 100.
339
341
  :param report_category: Used to filter reports with a specific type.
340
342
  :param target_id: Get reports for a specific player by passing their player ID.
341
343
  :param limit: Number of results to return.
@@ -28,7 +28,8 @@ from typing import TYPE_CHECKING
28
28
 
29
29
  from ..params.builders import build_params
30
30
  from ..type_hints import SortOptions, RaceCatOptions, UserListCatOptions, AttackFiltersOptions, \
31
- UserPropertiesFiltersOptions, ReportCatOptions, UserPrsnlStatsCatOptions, UserPrsnlStatsStatOptions
31
+ UserPropertiesFiltersOptions, ReportCatOptions, UserPrsnlStatsCatOptions, UserPrsnlStatsStatOptions, \
32
+ UserTradeCatOptions
32
33
 
33
34
  if TYPE_CHECKING:
34
35
  from ..client import TornAPIWrapper
@@ -667,6 +668,8 @@ class User:
667
668
  """
668
669
  Get your reports.
669
670
  API key (Limited).
671
+ The limit is set to 25 when requesting any category other than 'stats'.
672
+ When requesting the 'stats' category, limit can be increased up to 100.
670
673
  :param report_category: Used to filter reports with a specific type.
671
674
  :param target_id: Get reports for a specific player by passing their player ID.
672
675
  :param limit: Number of results to return.
@@ -735,6 +738,36 @@ class User:
735
738
  """
736
739
  return self.api.request("/user/stocks", build_params(self.get_stocks, locals()))
737
740
 
741
+ def get_trades(self, trade_category: UserTradeCatOptions = "ongoing", limit: int = 100, sort: SortOptions = "DESC", to: int = None, from_: int = None, timestamp: int = None, comment: str = None) -> dict:
742
+ """
743
+ Get your trades.
744
+ API key (Limited).
745
+ When requesting 'ongoing' trades (default), limit/offset/sort are not being used.
746
+ :param trade_category: Category of trades returned.
747
+ :param limit: Number of results to return.
748
+ :param sort: Sorted by the greatest timestamps.
749
+ :param to: Timestamp that sets the upper limit for the data returned. Data returned will be up to and including this time.
750
+ :param from_: Timestamp that sets the lower limit for the data returned. Data returned will be after this time.
751
+ :param timestamp: Timestamp to bypass cache.
752
+ :param comment: Comment for your tool/service/bot/website to be visible in the logs.
753
+ :return: API response data.
754
+ :rtype: dict
755
+ """
756
+ return self.api.request("/user/trades", build_params(self.get_trades, locals()))
757
+
758
+ def get_trade(self, trade_id: int, timestamp: int = None, comment: str = None) -> dict:
759
+ """
760
+ Get your detailed trade.
761
+ API key (Limited).
762
+ Only possible to get trades you participated in.
763
+ :param trade_id: Trade id.
764
+ :param timestamp: Timestamp to bypass cache.
765
+ :param comment: Comment for your tool/service/bot/website to be visible in the logs.
766
+ :return: API response data.
767
+ :rtype: dict
768
+ """
769
+ return self.api.request("/user/trade", build_params(self.get_trade, locals()))
770
+
738
771
  def get_travel(self, timestamp: int = None, comment: str = None) -> dict:
739
772
  """
740
773
  Get your travel information.
@@ -170,7 +170,7 @@ class Faction:
170
170
  """
171
171
  return await self.api.request("/faction/contributors", build_params(self.get_contributors, locals()))
172
172
 
173
- async def get_crimes(self, crimes_category: FacCrimesCatOptions = "all", crimes_filter: FacCrimesFiltersOptions = None, offset: int = 0, sort: SortOptions = "DESC", to: int = None, from_: int = None, timestamp: int = None, comment: str = None) -> dict:
173
+ async def get_crimes(self, crimes_category: FacCrimesCatOptions = "all", crimes_filter: FacCrimesFiltersOptions = None, limit: int = 20, offset: int = 0, sort: SortOptions = "DESC", to: int = None, from_: int = None, timestamp: int = None, comment: str = None) -> dict:
174
174
  """
175
175
  Get your faction's organized crimes.
176
176
  Requires faction API access permissions.
@@ -183,6 +183,7 @@ class Faction:
183
183
  - For category 'planning', the ordering field is 'ready_at'.
184
184
  :param crimes_category: Category of organized crimes returned. Category 'available' includes both 'recruiting' & 'planning', and category 'completed' includes both 'successful' & 'failure'.
185
185
  :param crimes_filter: It's possible to set this parameter to specify a field used for the sort, from & to query parameters. If not specified, the field will default to the category sorting as described above.
186
+ :param limit: Number of results to return.
186
187
  :param offset: Number of rows to skip before returning results.
187
188
  :param sort: Sorted by the greatest timestamps.
188
189
  :param to: Timestamp that sets the upper limit for the data returned. Data returned will be up to and including this time.
@@ -335,7 +336,8 @@ class Faction:
335
336
  """
336
337
  Get faction reports.
337
338
  API key (Limited).
338
- The default limit is set to 25. However, the limit can be set to 100 for the 'stats' category.
339
+ The limit is set to 25 when requesting any category other than 'stats'.
340
+ When requesting the 'stats' category, limit can be increased up to 100.
339
341
  :param report_category: Used to filter reports with a specific type.
340
342
  :param target_id: Get reports for a specific player by passing their player ID.
341
343
  :param limit: Number of results to return.
@@ -28,7 +28,8 @@ from typing import TYPE_CHECKING
28
28
 
29
29
  from ..params.builders import build_params
30
30
  from ..type_hints import SortOptions, RaceCatOptions, UserListCatOptions, AttackFiltersOptions, \
31
- UserPropertiesFiltersOptions, ReportCatOptions, UserPrsnlStatsCatOptions, UserPrsnlStatsStatOptions
31
+ UserPropertiesFiltersOptions, ReportCatOptions, UserPrsnlStatsCatOptions, UserPrsnlStatsStatOptions, \
32
+ UserTradeCatOptions
32
33
 
33
34
  if TYPE_CHECKING:
34
35
  from ..client_async import TornAPIWrapperAsync
@@ -667,6 +668,8 @@ class User:
667
668
  """
668
669
  Get your reports.
669
670
  API key (Limited).
671
+ The limit is set to 25 when requesting any category other than 'stats'.
672
+ When requesting the 'stats' category, limit can be increased up to 100.
670
673
  :param report_category: Used to filter reports with a specific type.
671
674
  :param target_id: Get reports for a specific player by passing their player ID.
672
675
  :param limit: Number of results to return.
@@ -735,6 +738,36 @@ class User:
735
738
  """
736
739
  return await self.api.request("/user/stocks", build_params(self.get_stocks, locals()))
737
740
 
741
+ async def get_trades(self, trade_category: UserTradeCatOptions = "ongoing", limit: int = 100, sort: SortOptions = "DESC", to: int = None, from_: int = None, timestamp: int = None, comment: str = None) -> dict:
742
+ """
743
+ Get your trades.
744
+ API key (Limited).
745
+ When requesting 'ongoing' trades (default), limit/offset/sort are not being used.
746
+ :param trade_category: Category of trades returned.
747
+ :param limit: Number of results to return.
748
+ :param sort: Sorted by the greatest timestamps.
749
+ :param to: Timestamp that sets the upper limit for the data returned. Data returned will be up to and including this time.
750
+ :param from_: Timestamp that sets the lower limit for the data returned. Data returned will be after this time.
751
+ :param timestamp: Timestamp to bypass cache.
752
+ :param comment: Comment for your tool/service/bot/website to be visible in the logs.
753
+ :return: API response data.
754
+ :rtype: dict
755
+ """
756
+ return await self.api.request("/user/trades", build_params(self.get_trades, locals()))
757
+
758
+ async def get_trade(self, trade_id: int, timestamp: int = None, comment: str = None) -> dict:
759
+ """
760
+ Get your detailed trade.
761
+ API key (Limited).
762
+ Only possible to get trades you participated in.
763
+ :param trade_id: Trade id.
764
+ :param timestamp: Timestamp to bypass cache.
765
+ :param comment: Comment for your tool/service/bot/website to be visible in the logs.
766
+ :return: API response data.
767
+ :rtype: dict
768
+ """
769
+ return await self.api.request("/user/trade", build_params(self.get_trade, locals()))
770
+
738
771
  async def get_travel(self, timestamp: int = None, comment: str = None) -> dict:
739
772
  """
740
773
  Get your travel information.
@@ -15,6 +15,7 @@ param_id = {
15
15
  "property_id",
16
16
  "property_type_id",
17
17
  "stock_id",
18
+ "trade_id",
18
19
  "race_id",
19
20
  "raid_war_id",
20
21
  "ranked_war_id",
@@ -38,6 +39,7 @@ param_cat = {
38
39
  "race_category",
39
40
  "report_category",
40
41
  "stat_category",
42
+ "trade_category",
41
43
  "warfare_category",
42
44
  }
43
45
  param_group = {
@@ -29,6 +29,7 @@ RaceCatOptions = Literal["official", "custom"]
29
29
  AttackFiltersOptions = Literal["incoming", "outgoing", "idFilter"]
30
30
  ReportCatOptions = Literal["mostwanted", "money", "stats", "references", "friendorfoe", "companyfinancials", "truelevel", "stockanalysis", "anonymousbounties", "investment"]
31
31
 
32
+ UserTradeCatOptions = Literal["finished", "ongoing"]
32
33
  UserListCatOptions = Literal["Friends", "Enemies", "Targets"]
33
34
  UserPropertiesFiltersOptions = Literal["ownedByUser", "ownedBySpouse"]
34
35
  UserPrsnlStatsCatOptions = Literal["all", "popular", "attacking", "battle_stats", "jobs", "trading", "jail", "hospital", "finishing_hits", "communication", "crimes", "bounties", "investments", "items", "travel", "drugs", "missions", "racing", "networth", "other", "itemmarketcustomers", "itemmarketsales", "itemmarketrevenue", "itemmarketfees"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TornAPIWrapper
3
- Version: 2.2.0
3
+ Version: 2.3.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-23.02.2026-c4c4c4?cacheSeconds=300></a>
56
+ <a href="https://www.torn.com/api.html#:~:text=Patch%20Notes"><img src=https://img.shields.io/badge/patch-10.03.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
 
File without changes
File without changes