psnawp 3.0.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.
Files changed (39) hide show
  1. psnawp-3.0.0/AUTHORS.md +17 -0
  2. psnawp-3.0.0/LICENSE.md +10 -0
  3. psnawp-3.0.0/PKG-INFO +202 -0
  4. psnawp-3.0.0/README.md +163 -0
  5. psnawp-3.0.0/pyproject.toml +129 -0
  6. psnawp-3.0.0/src/psnawp_api/__init__.py +5 -0
  7. psnawp-3.0.0/src/psnawp_api/core/__init__.py +50 -0
  8. psnawp-3.0.0/src/psnawp_api/core/authenticator.py +492 -0
  9. psnawp-3.0.0/src/psnawp_api/core/psnawp_exceptions.py +49 -0
  10. psnawp-3.0.0/src/psnawp_api/core/request_builder.py +320 -0
  11. psnawp-3.0.0/src/psnawp_api/models/__init__.py +25 -0
  12. psnawp-3.0.0/src/psnawp_api/models/client.py +639 -0
  13. psnawp-3.0.0/src/psnawp_api/models/game_entitlements.py +166 -0
  14. psnawp-3.0.0/src/psnawp_api/models/game_title.py +219 -0
  15. psnawp-3.0.0/src/psnawp_api/models/group/__init__.py +16 -0
  16. psnawp-3.0.0/src/psnawp_api/models/group/group.py +271 -0
  17. psnawp-3.0.0/src/psnawp_api/models/group/group_datatypes.py +80 -0
  18. psnawp-3.0.0/src/psnawp_api/models/listing/__init__.py +22 -0
  19. psnawp-3.0.0/src/psnawp_api/models/listing/pagination_iterator.py +170 -0
  20. psnawp-3.0.0/src/psnawp_api/models/search/__init__.py +23 -0
  21. psnawp-3.0.0/src/psnawp_api/models/search/games_search.py +245 -0
  22. psnawp-3.0.0/src/psnawp_api/models/search/games_search_datatypes.py +189 -0
  23. psnawp-3.0.0/src/psnawp_api/models/search/universal_search.py +73 -0
  24. psnawp-3.0.0/src/psnawp_api/models/search/users_result_datatypes.py +133 -0
  25. psnawp-3.0.0/src/psnawp_api/models/search/users_search.py +229 -0
  26. psnawp-3.0.0/src/psnawp_api/models/title_stats.py +188 -0
  27. psnawp-3.0.0/src/psnawp_api/models/trophies/__init__.py +44 -0
  28. psnawp-3.0.0/src/psnawp_api/models/trophies/trophy.py +327 -0
  29. psnawp-3.0.0/src/psnawp_api/models/trophies/trophy_constants.py +73 -0
  30. psnawp-3.0.0/src/psnawp_api/models/trophies/trophy_group.py +361 -0
  31. psnawp-3.0.0/src/psnawp_api/models/trophies/trophy_summary.py +79 -0
  32. psnawp-3.0.0/src/psnawp_api/models/trophies/trophy_titles.py +280 -0
  33. psnawp-3.0.0/src/psnawp_api/models/trophies/trophy_utils.py +15 -0
  34. psnawp-3.0.0/src/psnawp_api/models/user.py +595 -0
  35. psnawp-3.0.0/src/psnawp_api/psnawp.py +332 -0
  36. psnawp-3.0.0/src/psnawp_api/py.typed +0 -0
  37. psnawp-3.0.0/src/psnawp_api/utils/__init__.py +23 -0
  38. psnawp-3.0.0/src/psnawp_api/utils/endpoints.py +70 -0
  39. psnawp-3.0.0/src/psnawp_api/utils/misc.py +104 -0
@@ -0,0 +1,17 @@
1
+ # Maintainers
2
+
3
+ - Yoshikage Kira @isFakeAccount <8bit_yoshikage_kira@proton.me>
4
+
5
+ # Source Contributors
6
+
7
+ - kerdion @kerdion
8
+ - andshrew @andshrew
9
+ - Omar Mujtaba @omz1990
10
+ - R @Dev-R
11
+ - Jack Powell @jackjpowell
12
+ - Manu @tr4nt0r
13
+
14
+ # Documentation Contributors
15
+ - andshrew @andshrew
16
+ - Niccolò @NiccoloGranieri
17
+ - R @Dev-R
@@ -0,0 +1,10 @@
1
+ # PlayStation API Python (PSNAWP)
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2021 isFakeAccount
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+
10
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
psnawp-3.0.0/PKG-INFO ADDED
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.3
2
+ Name: psnawp
3
+ Version: 3.0.0
4
+ Summary: Python API Wrapper for PlayStation Network API.
5
+ License: # PlayStation API Python (PSNAWP)
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2021 isFakeAccount
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ Keywords: PSN,PlayStation
16
+ Author: Yoshikage Kira
17
+ Author-email: 8bit_yoshikage_kira@proton.me
18
+ Requires-Python: >=3.10, <4.0
19
+ Classifier: Development Status :: 5 - Production/Stable
20
+ Classifier: Intended Audience :: Developers
21
+ Classifier: License :: OSI Approved :: MIT License
22
+ Classifier: Operating System :: OS Independent
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python
28
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
+ Requires-Dist: pycountry (>=24.6.1,<25.0.0)
30
+ Requires-Dist: pyrate-limiter (>=3.7.0,<4.0.0)
31
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
32
+ Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
33
+ Project-URL: Documentation, https://psnawp.readthedocs.io/en/latest/
34
+ Project-URL: Homepage, https://github.com/isFakeAccount/psnawp
35
+ Project-URL: Repository, https://github.com/isFakeAccount/psnawp
36
+ Project-URL: changelog, https://github.com/isFakeAccount/psnawp/commits/master/
37
+ Description-Content-Type: text/markdown
38
+
39
+ # <img src="docs/_static/psn_logo.png" alt="PlayStation Logo" height="35px"> PlayStation Network API Wrapper Python (PSNAWP)
40
+
41
+ Retrieve User Information, Trophies, Game and Store data from the PlayStation Network.
42
+
43
+ [![PyPI version](https://badge.fury.io/py/PSNAWP.svg)](https://badge.fury.io/py/PSNAWP)
44
+ [![Downloads](https://static.pepy.tech/badge/psnawp)](https://www.pepy.tech/projects/psnawp)
45
+ [![python-logo](https://img.shields.io/badge/python-3.10_|_3.11_|_3.12_|_3.13-blue.svg)](https://www.python.org/)
46
+ [![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
47
+ [![Documentation Status](https://readthedocs.org/projects/psnawp/badge/?version=latest)](https://psnawp.readthedocs.io/en/latest/?badge=latest)
48
+ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
49
+ [![pre-commit](https://github.com/isFakeAccount/psnawp/actions/workflows/pre-commit.yaml/badge.svg)](https://github.com/isFakeAccount/psnawp/actions/workflows/pre-commit.yaml)
50
+ [![Pytest](https://github.com/isFakeAccount/psnawp/actions/workflows/pytest-entry.yaml/badge.svg)](https://github.com/isFakeAccount/psnawp/actions/workflows/pytest-entry.yaml)
51
+ [![codecov](https://codecov.io/gh/isFakeAccount/psnawp/graph/badge.svg?token=W8755O8BQ9)](https://codecov.io/gh/isFakeAccount/psnawp)
52
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
53
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/MIT)
54
+
55
+ <!-- Pytest Coverage Comment:Begin -->
56
+ <a href="https://github.com/isFakeAccount/psnawp/blob/master/README.md"><img alt="Coverage" src="https://img.shields.io/badge/Coverage-94%25-brightgreen.svg" /></a><details><summary>Coverage Report </summary><table><tr><th>File</th><th>Stmts</th><th>Miss</th><th>Cover</th><th>Missing</th></tr><tbody><tr><td colspan="5"><b>src/psnawp_api</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/__init__.py">__init__.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/psnawp.py">psnawp.py</a></td><td>47</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>src/psnawp_api/core</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/__init__.py">__init__.py</a></td><td>4</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/authenticator.py">authenticator.py</a></td><td>131</td><td>17</td><td>17</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/authenticator.py#L 87%"> 87%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/psnawp_exceptions.py">psnawp_exceptions.py</a></td><td>12</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/request_builder.py">request_builder.py</a></td><td>80</td><td>9</td><td>9</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/request_builder.py#L 89%"> 89%</a></td></tr><tr><td colspan="5"><b>src/psnawp_api/models</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/__init__.py">__init__.py</a></td><td>5</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/client.py">client.py</a></td><td>85</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/game_entitlements.py">game_entitlements.py</a></td><td>68</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/game_title.py">game_title.py</a></td><td>45</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/title_stats.py">title_stats.py</a></td><td>72</td><td>1</td><td>1</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/title_stats.py#L 99%"> 99%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/user.py">user.py</a></td><td>87</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>src/psnawp_api/models/group</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/group/__init__.py">__init__.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/group/group.py">group.py</a></td><td>56</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/group/group_datatypes.py">group_datatypes.py</a></td><td>42</td><td>42</td><td>42</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/group/group_datatypes.py#L 0%"> 0%</a></td></tr><tr><td colspan="5"><b>src/psnawp_api/models/listing</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/listing/__init__.py">__init__.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/listing/pagination_iterator.py">pagination_iterator.py</a></td><td>52</td><td>2</td><td>2</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/listing/pagination_iterator.py#L 96%"> 96%</a></td></tr><tr><td colspan="5"><b>src/psnawp_api/models/search</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/__init__.py">__init__.py</a></td><td>4</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/games_search.py">games_search.py</a></td><td>58</td><td>1</td><td>1</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/games_search.py#L 98%"> 98%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/games_search_datatypes.py">games_search_datatypes.py</a></td><td>95</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/universal_search.py">universal_search.py</a></td><td>13</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/users_result_datatypes.py">users_result_datatypes.py</a></td><td>57</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/users_search.py">users_search.py</a></td><td>56</td><td>2</td><td>2</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/users_search.py#L 96%"> 96%</a></td></tr><tr><td colspan="5"><b>src/psnawp_api/models/trophies</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/__init__.py">__init__.py</a></td><td>6</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy.py">trophy.py</a></td><td>106</td><td>7</td><td>7</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy.py#L 93%"> 93%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_constants.py">trophy_constants.py</a></td><td>33</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_group.py">trophy_group.py</a></td><td>65</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_summary.py">trophy_summary.py</a></td><td>20</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_titles.py">trophy_titles.py</a></td><td>71</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_utils.py">trophy_utils.py</a></td><td>6</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>src/psnawp_api/utils</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/utils/__init__.py">__init__.py</a></td><td>3</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/utils/endpoints.py">endpoints.py</a></td><td>3</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/utils/misc.py">misc.py</a></td><td>42</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td><b>TOTAL</b></td><td><b>1430</b></td><td><b>81</b></td><td><b>94%</b></td><td>&nbsp;</td></tr></tbody></table></details>
57
+ <!-- Pytest Coverage Comment:End -->
58
+
59
+ ## How to install
60
+
61
+ ### From PyPI
62
+
63
+ ```
64
+ pip install PSNAWP
65
+ ```
66
+
67
+ ## Important Links
68
+ > PyPI: https://pypi.org/project/PSNAWP/
69
+ >
70
+ > Read the Docs: https://psnawp.readthedocs.io
71
+
72
+ ## Getting Started
73
+
74
+ > [!CAUTION]
75
+ > This library is an unofficial and reverse-engineered API wrapper for the PlayStation Network (PSN). It has been developed based on the reverse engineering of the PSN Android app. The API wrapper (>= v2.1.0) will self rate limit at 300 requests per 15 minutes. However, it is still important that you don't send bulk requests using this API. Excessive use of API may lead to your PSN account being temporarily or permanently banned.
76
+ >
77
+ > You can also create a dedicated account to use this library so that in the worst-case scenario you do not lose access to your primary account, along with your video games and progress.
78
+
79
+ To get started you need to obtain npsso <64 character code>. You need to follow the following steps
80
+
81
+ 1. Login into your [My PlayStation](https://my.playstation.com/) account.
82
+ 2. In another tab, go to `https://ca.account.sony.com/api/v1/ssocookie`
83
+ 3. If you are logged in you should see a text similar to this
84
+
85
+ ```json
86
+ {"npsso":"<64 character npsso code>"}
87
+ ```
88
+ This npsso code will be used in the api for authentication purposes. The refresh token that is generated from npsso lasts about 2 months. After that you have to get a new npsso token. The bot will print a warning if there are less than 3 days left in refresh token expiration.
89
+
90
+ Following is the quick example on how to use this library
91
+
92
+ ```py
93
+ from psnawp_api import PSNAWP
94
+ from psnawp_api.models import SearchDomain
95
+ from psnawp_api.models.trophies import PlatformType
96
+
97
+ psnawp = PSNAWP("<64 character npsso code>")
98
+
99
+ # Your Personal Account Info
100
+ client = psnawp.me()
101
+ print(f"Online ID: {client.online_id}")
102
+ print(f"Account ID: {client.account_id}")
103
+ print(f"Region: {client.get_region()}")
104
+ print(f"Profile: {client.get_profile_legacy()} \n")
105
+
106
+ # Your Registered Devices
107
+ devices = client.get_account_devices()
108
+ for device in devices:
109
+ print(f"Device: {device} \n")
110
+
111
+ # Your Friends List
112
+ friends_list = client.friends_list()
113
+ for friend in friends_list:
114
+ print(f"Friend: {friend} \n")
115
+
116
+ # Your Players Blocked List
117
+ blocked_list = client.blocked_list()
118
+ for blocked_user in blocked_list:
119
+ print(f"Blocked User: {blocked_user} \n")
120
+
121
+ # Your Friends in "Notify when available" List
122
+ available_to_play = client.available_to_play()
123
+ for user in available_to_play:
124
+ print(f"Available to Play: {user} \n")
125
+
126
+ # Your trophies (PS4)
127
+ for trophy in client.trophies("NPWR22810_00", PlatformType.PS4):
128
+ print(trophy)
129
+
130
+ # Your Chat Groups
131
+ groups = client.get_groups()
132
+ first_group_id = None # This will be used later to test group methods
133
+ for id, group in enumerate(groups):
134
+ if id == 0: # Get the first group ID
135
+ first_group_id = group.group_id
136
+
137
+ group_info = group.get_group_information()
138
+ print(f"Group {id}: {group_info} \n")
139
+
140
+ # Your Playing time (PS4, PS5 above only)
141
+ titles_with_stats = client.title_stats()
142
+ for title in titles_with_stats:
143
+ print(
144
+ f" \
145
+ Game: {title.name} - \
146
+ Play Count: {title.play_count} - \
147
+ Play Duration: {title.play_duration} \n"
148
+ )
149
+
150
+
151
+ # Other User's
152
+ example_user_1 = psnawp.user(online_id="VaultTec-Co") # Get a PSN player by their Online ID
153
+ print(f"User 1 Online ID: {example_user_1.online_id}")
154
+ print(f"User 1 Account ID: {example_user_1.account_id}")
155
+ print(f"User 1 Region: {example_user_1.get_region()}")
156
+
157
+ print(example_user_1.profile())
158
+ print(example_user_1.prev_online_id)
159
+ print(example_user_1.get_presence())
160
+ print(example_user_1.friendship())
161
+ print(example_user_1.is_blocked())
162
+
163
+ # Example of getting a user by their account ID
164
+ user_account_id = psnawp.user(account_id="9122947611907501295")
165
+ print(f"User Account ID: {user_account_id.online_id}")
166
+
167
+
168
+ # Messaging and Groups Interaction
169
+ group = psnawp.group(group_id=first_group_id) # This is the first group ID we got earlier - i.e. the first group in your groups list
170
+ print(group.get_group_information())
171
+ print(group.get_conversation(10)) # Get the last 10 messages in the group
172
+ print(group.send_message("Hello World"))
173
+ print(group.change_name("API Testing 3"))
174
+ # print(group.leave_group()) # Uncomment to leave the group
175
+
176
+ # Create a new group with other users - i.e. 'VaultTec-Co' and 'test'
177
+ example_user_2 = psnawp.user(online_id="test")
178
+ new_group = psnawp.group(users_list=[example_user_1, example_user_2])
179
+ print(new_group.get_group_information())
180
+ # You can use the same above methods to interact with the new group - i.e. send messages, change name, etc.
181
+
182
+ # Searching for Game Titles
183
+ search = psnawp.search(search_query="GTA 5", search_domain=SearchDomain.FULL_GAMES)
184
+ for search_result in search:
185
+ print(search_result["result"]["invariantName"])
186
+
187
+ ```
188
+
189
+ **Note: If you want to create multiple instances of psnawp you need to get npsso code from separate PSN accounts. If you generate a new npsso with same account your previous npsso will expire immediately.**
190
+
191
+ ## Contribution
192
+
193
+ All bug reposts and features requests are welcomed, although I am new at making python libraries, so it may take me a while to implement some features. Suggestions are welcomes if I am doing something that is an unconventional way of doing it.
194
+
195
+ ## Disclaimer
196
+
197
+ This project was not intended to be used for spam, abuse, or anything of the sort. Any use of this project for those purposes is not endorsed. Please keep this in mind when creating applications using this API wrapper.
198
+
199
+ ## Credit
200
+
201
+ This project contains code from PlayStationNetwork::API and PSN-PHP Wrapper that was translated to Python. Also, special thanks @andshrew for documenting the PlayStation Trophy endpoints. All licenses are included in this repository.
202
+
psnawp-3.0.0/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # <img src="docs/_static/psn_logo.png" alt="PlayStation Logo" height="35px"> PlayStation Network API Wrapper Python (PSNAWP)
2
+
3
+ Retrieve User Information, Trophies, Game and Store data from the PlayStation Network.
4
+
5
+ [![PyPI version](https://badge.fury.io/py/PSNAWP.svg)](https://badge.fury.io/py/PSNAWP)
6
+ [![Downloads](https://static.pepy.tech/badge/psnawp)](https://www.pepy.tech/projects/psnawp)
7
+ [![python-logo](https://img.shields.io/badge/python-3.10_|_3.11_|_3.12_|_3.13-blue.svg)](https://www.python.org/)
8
+ [![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
9
+ [![Documentation Status](https://readthedocs.org/projects/psnawp/badge/?version=latest)](https://psnawp.readthedocs.io/en/latest/?badge=latest)
10
+ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
11
+ [![pre-commit](https://github.com/isFakeAccount/psnawp/actions/workflows/pre-commit.yaml/badge.svg)](https://github.com/isFakeAccount/psnawp/actions/workflows/pre-commit.yaml)
12
+ [![Pytest](https://github.com/isFakeAccount/psnawp/actions/workflows/pytest-entry.yaml/badge.svg)](https://github.com/isFakeAccount/psnawp/actions/workflows/pytest-entry.yaml)
13
+ [![codecov](https://codecov.io/gh/isFakeAccount/psnawp/graph/badge.svg?token=W8755O8BQ9)](https://codecov.io/gh/isFakeAccount/psnawp)
14
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
15
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/MIT)
16
+
17
+ <!-- Pytest Coverage Comment:Begin -->
18
+ <a href="https://github.com/isFakeAccount/psnawp/blob/master/README.md"><img alt="Coverage" src="https://img.shields.io/badge/Coverage-94%25-brightgreen.svg" /></a><details><summary>Coverage Report </summary><table><tr><th>File</th><th>Stmts</th><th>Miss</th><th>Cover</th><th>Missing</th></tr><tbody><tr><td colspan="5"><b>src/psnawp_api</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/__init__.py">__init__.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/psnawp.py">psnawp.py</a></td><td>47</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>src/psnawp_api/core</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/__init__.py">__init__.py</a></td><td>4</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/authenticator.py">authenticator.py</a></td><td>131</td><td>17</td><td>17</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/authenticator.py#L 87%"> 87%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/psnawp_exceptions.py">psnawp_exceptions.py</a></td><td>12</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/request_builder.py">request_builder.py</a></td><td>80</td><td>9</td><td>9</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/core/request_builder.py#L 89%"> 89%</a></td></tr><tr><td colspan="5"><b>src/psnawp_api/models</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/__init__.py">__init__.py</a></td><td>5</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/client.py">client.py</a></td><td>85</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/game_entitlements.py">game_entitlements.py</a></td><td>68</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/game_title.py">game_title.py</a></td><td>45</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/title_stats.py">title_stats.py</a></td><td>72</td><td>1</td><td>1</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/title_stats.py#L 99%"> 99%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/user.py">user.py</a></td><td>87</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>src/psnawp_api/models/group</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/group/__init__.py">__init__.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/group/group.py">group.py</a></td><td>56</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/group/group_datatypes.py">group_datatypes.py</a></td><td>42</td><td>42</td><td>42</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/group/group_datatypes.py#L 0%"> 0%</a></td></tr><tr><td colspan="5"><b>src/psnawp_api/models/listing</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/listing/__init__.py">__init__.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/listing/pagination_iterator.py">pagination_iterator.py</a></td><td>52</td><td>2</td><td>2</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/listing/pagination_iterator.py#L 96%"> 96%</a></td></tr><tr><td colspan="5"><b>src/psnawp_api/models/search</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/__init__.py">__init__.py</a></td><td>4</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/games_search.py">games_search.py</a></td><td>58</td><td>1</td><td>1</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/games_search.py#L 98%"> 98%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/games_search_datatypes.py">games_search_datatypes.py</a></td><td>95</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/universal_search.py">universal_search.py</a></td><td>13</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/users_result_datatypes.py">users_result_datatypes.py</a></td><td>57</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/users_search.py">users_search.py</a></td><td>56</td><td>2</td><td>2</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/search/users_search.py#L 96%"> 96%</a></td></tr><tr><td colspan="5"><b>src/psnawp_api/models/trophies</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/__init__.py">__init__.py</a></td><td>6</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy.py">trophy.py</a></td><td>106</td><td>7</td><td>7</td><td><a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy.py#L 93%"> 93%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_constants.py">trophy_constants.py</a></td><td>33</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_group.py">trophy_group.py</a></td><td>65</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_summary.py">trophy_summary.py</a></td><td>20</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_titles.py">trophy_titles.py</a></td><td>71</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/models/trophies/trophy_utils.py">trophy_utils.py</a></td><td>6</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>src/psnawp_api/utils</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/utils/__init__.py">__init__.py</a></td><td>3</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/utils/endpoints.py">endpoints.py</a></td><td>3</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/isFakeAccount/psnawp/blob/master/src/psnawp_api/utils/misc.py">misc.py</a></td><td>42</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td><b>TOTAL</b></td><td><b>1430</b></td><td><b>81</b></td><td><b>94%</b></td><td>&nbsp;</td></tr></tbody></table></details>
19
+ <!-- Pytest Coverage Comment:End -->
20
+
21
+ ## How to install
22
+
23
+ ### From PyPI
24
+
25
+ ```
26
+ pip install PSNAWP
27
+ ```
28
+
29
+ ## Important Links
30
+ > PyPI: https://pypi.org/project/PSNAWP/
31
+ >
32
+ > Read the Docs: https://psnawp.readthedocs.io
33
+
34
+ ## Getting Started
35
+
36
+ > [!CAUTION]
37
+ > This library is an unofficial and reverse-engineered API wrapper for the PlayStation Network (PSN). It has been developed based on the reverse engineering of the PSN Android app. The API wrapper (>= v2.1.0) will self rate limit at 300 requests per 15 minutes. However, it is still important that you don't send bulk requests using this API. Excessive use of API may lead to your PSN account being temporarily or permanently banned.
38
+ >
39
+ > You can also create a dedicated account to use this library so that in the worst-case scenario you do not lose access to your primary account, along with your video games and progress.
40
+
41
+ To get started you need to obtain npsso <64 character code>. You need to follow the following steps
42
+
43
+ 1. Login into your [My PlayStation](https://my.playstation.com/) account.
44
+ 2. In another tab, go to `https://ca.account.sony.com/api/v1/ssocookie`
45
+ 3. If you are logged in you should see a text similar to this
46
+
47
+ ```json
48
+ {"npsso":"<64 character npsso code>"}
49
+ ```
50
+ This npsso code will be used in the api for authentication purposes. The refresh token that is generated from npsso lasts about 2 months. After that you have to get a new npsso token. The bot will print a warning if there are less than 3 days left in refresh token expiration.
51
+
52
+ Following is the quick example on how to use this library
53
+
54
+ ```py
55
+ from psnawp_api import PSNAWP
56
+ from psnawp_api.models import SearchDomain
57
+ from psnawp_api.models.trophies import PlatformType
58
+
59
+ psnawp = PSNAWP("<64 character npsso code>")
60
+
61
+ # Your Personal Account Info
62
+ client = psnawp.me()
63
+ print(f"Online ID: {client.online_id}")
64
+ print(f"Account ID: {client.account_id}")
65
+ print(f"Region: {client.get_region()}")
66
+ print(f"Profile: {client.get_profile_legacy()} \n")
67
+
68
+ # Your Registered Devices
69
+ devices = client.get_account_devices()
70
+ for device in devices:
71
+ print(f"Device: {device} \n")
72
+
73
+ # Your Friends List
74
+ friends_list = client.friends_list()
75
+ for friend in friends_list:
76
+ print(f"Friend: {friend} \n")
77
+
78
+ # Your Players Blocked List
79
+ blocked_list = client.blocked_list()
80
+ for blocked_user in blocked_list:
81
+ print(f"Blocked User: {blocked_user} \n")
82
+
83
+ # Your Friends in "Notify when available" List
84
+ available_to_play = client.available_to_play()
85
+ for user in available_to_play:
86
+ print(f"Available to Play: {user} \n")
87
+
88
+ # Your trophies (PS4)
89
+ for trophy in client.trophies("NPWR22810_00", PlatformType.PS4):
90
+ print(trophy)
91
+
92
+ # Your Chat Groups
93
+ groups = client.get_groups()
94
+ first_group_id = None # This will be used later to test group methods
95
+ for id, group in enumerate(groups):
96
+ if id == 0: # Get the first group ID
97
+ first_group_id = group.group_id
98
+
99
+ group_info = group.get_group_information()
100
+ print(f"Group {id}: {group_info} \n")
101
+
102
+ # Your Playing time (PS4, PS5 above only)
103
+ titles_with_stats = client.title_stats()
104
+ for title in titles_with_stats:
105
+ print(
106
+ f" \
107
+ Game: {title.name} - \
108
+ Play Count: {title.play_count} - \
109
+ Play Duration: {title.play_duration} \n"
110
+ )
111
+
112
+
113
+ # Other User's
114
+ example_user_1 = psnawp.user(online_id="VaultTec-Co") # Get a PSN player by their Online ID
115
+ print(f"User 1 Online ID: {example_user_1.online_id}")
116
+ print(f"User 1 Account ID: {example_user_1.account_id}")
117
+ print(f"User 1 Region: {example_user_1.get_region()}")
118
+
119
+ print(example_user_1.profile())
120
+ print(example_user_1.prev_online_id)
121
+ print(example_user_1.get_presence())
122
+ print(example_user_1.friendship())
123
+ print(example_user_1.is_blocked())
124
+
125
+ # Example of getting a user by their account ID
126
+ user_account_id = psnawp.user(account_id="9122947611907501295")
127
+ print(f"User Account ID: {user_account_id.online_id}")
128
+
129
+
130
+ # Messaging and Groups Interaction
131
+ group = psnawp.group(group_id=first_group_id) # This is the first group ID we got earlier - i.e. the first group in your groups list
132
+ print(group.get_group_information())
133
+ print(group.get_conversation(10)) # Get the last 10 messages in the group
134
+ print(group.send_message("Hello World"))
135
+ print(group.change_name("API Testing 3"))
136
+ # print(group.leave_group()) # Uncomment to leave the group
137
+
138
+ # Create a new group with other users - i.e. 'VaultTec-Co' and 'test'
139
+ example_user_2 = psnawp.user(online_id="test")
140
+ new_group = psnawp.group(users_list=[example_user_1, example_user_2])
141
+ print(new_group.get_group_information())
142
+ # You can use the same above methods to interact with the new group - i.e. send messages, change name, etc.
143
+
144
+ # Searching for Game Titles
145
+ search = psnawp.search(search_query="GTA 5", search_domain=SearchDomain.FULL_GAMES)
146
+ for search_result in search:
147
+ print(search_result["result"]["invariantName"])
148
+
149
+ ```
150
+
151
+ **Note: If you want to create multiple instances of psnawp you need to get npsso code from separate PSN accounts. If you generate a new npsso with same account your previous npsso will expire immediately.**
152
+
153
+ ## Contribution
154
+
155
+ All bug reposts and features requests are welcomed, although I am new at making python libraries, so it may take me a while to implement some features. Suggestions are welcomes if I am doing something that is an unconventional way of doing it.
156
+
157
+ ## Disclaimer
158
+
159
+ This project was not intended to be used for spam, abuse, or anything of the sort. Any use of this project for those purposes is not endorsed. Please keep this in mind when creating applications using this API wrapper.
160
+
161
+ ## Credit
162
+
163
+ This project contains code from PlayStationNetwork::API and PSN-PHP Wrapper that was translated to Python. Also, special thanks @andshrew for documenting the PlayStation Trophy endpoints. All licenses are included in this repository.
@@ -0,0 +1,129 @@
1
+ [project]
2
+ authors = [{ name = "Yoshikage Kira", email = "8bit_yoshikage_kira@proton.me" }]
3
+ classifiers = [
4
+ "Development Status :: 5 - Production/Stable",
5
+ "Intended Audience :: Developers",
6
+ "License :: OSI Approved :: MIT License",
7
+ "Operating System :: OS Independent",
8
+ "Programming Language :: Python :: 3.10",
9
+ "Programming Language :: Python :: 3.11",
10
+ "Programming Language :: Python :: 3.12",
11
+ "Programming Language :: Python :: 3.13",
12
+ "Programming Language :: Python",
13
+ "Topic :: Software Development :: Libraries :: Python Modules",
14
+ ]
15
+ dependencies = [
16
+ "pycountry (>=24.6.1,<25.0.0)",
17
+ "pyrate-limiter (>=3.7.0,<4.0.0)",
18
+ "requests (>=2.32.3,<3.0.0)",
19
+ "typing-extensions (>=4.12.2,<5.0.0)",
20
+ ]
21
+ description = "Python API Wrapper for PlayStation Network API."
22
+ keywords = ["PSN", "PlayStation"]
23
+ license = { file = "LICENSE.md" }
24
+ name = "psnawp"
25
+ readme = "README.md"
26
+ requires-python = ">=3.10, <4.0"
27
+ version = "3.0.0"
28
+
29
+ [tool.poetry.group.typing.dependencies]
30
+ mypy = { version = "^1.15.0", python = ">=3.11,<4.0.0" }
31
+ pyright = { version = "^1.1.398", python = ">=3.11,<4.0.0" }
32
+ types-requests = { version = "^2.31.0", python = ">=3.11,<4.0.0" }
33
+
34
+ [tool.poetry.group.docs.dependencies]
35
+ myst-parser = { extras = ["linkify"], version = "^4.0.1", python = ">=3.11,<4.0.0" }
36
+ sphinx = { version = "^8.2.3", python = ">=3.11,<4.0.0" }
37
+ sphinx-book-theme = { version = "^1.1.4", python = ">=3.11,<4.0.0" }
38
+ sphinx-copybutton = { version = "^0.5.2", python = ">=3.11,<4.0.0" }
39
+
40
+ [tool.poetry.group.linting.dependencies]
41
+ docstrfmt = { version = "^1.10.0", python = ">=3.11,<4.0.0" }
42
+ pre-commit = { version = "^4.2.0", python = ">=3.11,<4.0.0" }
43
+ ruff = { version = "^0.11.2", python = ">=3.11,<4.0.0" }
44
+
45
+ [tool.poetry.group.tests.dependencies]
46
+ jsonschema = { version = "^4.23.0", python = ">=3.10,<4.0.0" }
47
+ pytest = { version = "^8.3.5", python = ">=3.10,<4.0.0" }
48
+ pytest-cov = { version = "^6.0.0", python = ">=3.10,<4.0.0" }
49
+ pytest-vcr = { version = "^1.0.2", python = ">=3.10,<4.0.0" }
50
+ python-dotenv = { version = "^1.1.0", python = ">=3.10,<4.0.0" }
51
+ vcrpy = { version = "^7.0.0", python = ">=3.10,<4.0.0" }
52
+
53
+ [project.urls]
54
+ changelog = "https://github.com/isFakeAccount/psnawp/commits/master/"
55
+ documentation = "https://psnawp.readthedocs.io/en/latest/"
56
+ homepage = "https://github.com/isFakeAccount/psnawp"
57
+ repository = "https://github.com/isFakeAccount/psnawp"
58
+
59
+ [build-system]
60
+ build-backend = "poetry.core.masonry.api"
61
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
62
+
63
+ [tool.poetry]
64
+ packages = [{ include = "psnawp_api", from = "src" }]
65
+
66
+ [tool.pytest.ini_options]
67
+ addopts = "--cov=psnawp_api --cov-report html --cov-report term --cov-report xml --junitxml=pytest.xml"
68
+ testpaths = ["tests"]
69
+
70
+ [tool.coverage.report]
71
+ exclude_also = [
72
+ "@overload",
73
+ "__repr__",
74
+ "__str__",
75
+ "if TYPE_CHECKING:",
76
+ "raise NotImplementedError",
77
+ ]
78
+
79
+ [tool.mypy]
80
+ check_untyped_defs = true
81
+ disallow_any_generics = true
82
+ exclude = [".venv", "venv"]
83
+ ignore_missing_imports = true
84
+ no_implicit_optional = true
85
+ no_implicit_reexport = true
86
+ show_error_codes = true
87
+ strict = true
88
+ strict_equality = true
89
+ warn_redundant_casts = true
90
+ warn_return_any = true
91
+ warn_unreachable = true
92
+ warn_unused_configs = true
93
+
94
+ [tool.pyright]
95
+ exclude = [".venv", "venv"]
96
+ pythonVersion = "3.10"
97
+ reportPrivateUsage = false
98
+ typeCheckingMode = "strict"
99
+
100
+ [tool.ruff]
101
+ line-length = 160
102
+
103
+ [tool.ruff.format]
104
+ docstring-code-format = true
105
+ docstring-code-line-length = 88
106
+
107
+ [tool.ruff.lint]
108
+ ignore = [
109
+ "COM812", # Allow missing trailing comma. (handled by ruff format)
110
+ "D203", # Allow class doc strings without requiring a blank line before them (conflicts with D211).
111
+ "D213", # Allow multi-line docstring summaries to end on the first line (conflicts with D212).
112
+ "D401", # Allow docstring summaries that are not in imperative mood.
113
+ "EM", # Allow exception messages that do not follow specific formatting rules.
114
+ "FBT", # Allow functions to take boolean positional arguments.
115
+ "S311", # Allow use of Standard pseudo-random generators.
116
+ "S603", # Allow `subprocess` calls without enforcing `shell=False` (potential security risk).
117
+ "T201", # Allow usage of `print()` instead of enforcing logging.
118
+ "TRY003", # Allow specifying long error messages inside the exception class instead of outside.
119
+ ]
120
+ select = ["ALL"]
121
+
122
+ [tool.ruff.lint.per-file-ignores]
123
+ "tests/*.py" = ["D", "S101", "SIM117"]
124
+
125
+ [tool.ruff.lint.pylint]
126
+ max-args = 15
127
+
128
+ [tool.docstrfmt]
129
+ line-length = 120
@@ -0,0 +1,5 @@
1
+ """PlayStation Network API Wrapper Python (PSNAWP) Retrieve User Information, Trophies, Game and Store data from the PlayStation Network."""
2
+
3
+ from psnawp_api.psnawp import PSNAWP
4
+
5
+ __all__ = ["PSNAWP"]
@@ -0,0 +1,50 @@
1
+ """Core package for the PlayStation API wrapper.
2
+
3
+ This package contains the foundational modules responsible for handling core functionalities such as authentication,
4
+ request management, and exception handling.
5
+
6
+ Modules in this package include:
7
+
8
+ - Authentication setup and token refresh.
9
+ - HTTP session and request logic.
10
+ - Custom exception classes and error handling utilities.
11
+
12
+ """
13
+
14
+ from psnawp_api.core.authenticator import Authenticator
15
+ from psnawp_api.core.psnawp_exceptions import (
16
+ PSNAWPAuthenticationError,
17
+ PSNAWPBadRequestError,
18
+ PSNAWPClientError,
19
+ PSNAWPError,
20
+ PSNAWPForbiddenError,
21
+ PSNAWPIllegalArgumentError,
22
+ PSNAWPNotAllowedError,
23
+ PSNAWPNotFoundError,
24
+ PSNAWPServerError,
25
+ PSNAWPTooManyRequestsError,
26
+ PSNAWPUnauthorizedError,
27
+ )
28
+ from psnawp_api.core.request_builder import (
29
+ RequestBuilder,
30
+ RequestBuilderHeaders,
31
+ RequestOptions,
32
+ )
33
+
34
+ __all__ = [
35
+ "Authenticator",
36
+ "PSNAWPAuthenticationError",
37
+ "PSNAWPBadRequestError",
38
+ "PSNAWPClientError",
39
+ "PSNAWPError",
40
+ "PSNAWPForbiddenError",
41
+ "PSNAWPIllegalArgumentError",
42
+ "PSNAWPNotAllowedError",
43
+ "PSNAWPNotFoundError",
44
+ "PSNAWPServerError",
45
+ "PSNAWPTooManyRequestsError",
46
+ "PSNAWPUnauthorizedError",
47
+ "RequestBuilder",
48
+ "RequestBuilderHeaders",
49
+ "RequestOptions",
50
+ ]