prism-py-sdk 0.4.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 (149) hide show
  1. prism_py_sdk-0.4.0/LICENSE +21 -0
  2. prism_py_sdk-0.4.0/PKG-INFO +271 -0
  3. prism_py_sdk-0.4.0/README.md +238 -0
  4. prism_py_sdk-0.4.0/pyproject.toml +97 -0
  5. prism_py_sdk-0.4.0/src/prism/__init__.py +56 -0
  6. prism_py_sdk-0.4.0/src/prism/_default_clients.py +32 -0
  7. prism_py_sdk-0.4.0/src/prism/api/__init__.py +198 -0
  8. prism_py_sdk-0.4.0/src/prism/api/client.py +63 -0
  9. prism_py_sdk-0.4.0/src/prism/api/errors/__init__.py +44 -0
  10. prism_py_sdk-0.4.0/src/prism/api/errors/bad_request_error.py +10 -0
  11. prism_py_sdk-0.4.0/src/prism/api/errors/forbidden_error.py +10 -0
  12. prism_py_sdk-0.4.0/src/prism/api/errors/internal_server_error.py +10 -0
  13. prism_py_sdk-0.4.0/src/prism/api/errors/too_many_requests_error.py +10 -0
  14. prism_py_sdk-0.4.0/src/prism/api/errors/unauthorized_error.py +10 -0
  15. prism_py_sdk-0.4.0/src/prism/api/raw_client.py +13 -0
  16. prism_py_sdk-0.4.0/src/prism/api/solana/__init__.py +52 -0
  17. prism_py_sdk-0.4.0/src/prism/api/solana/client.py +63 -0
  18. prism_py_sdk-0.4.0/src/prism/api/solana/dex/__init__.py +49 -0
  19. prism_py_sdk-0.4.0/src/prism/api/solana/dex/client.py +1268 -0
  20. prism_py_sdk-0.4.0/src/prism/api/solana/dex/raw_client.py +2497 -0
  21. prism_py_sdk-0.4.0/src/prism/api/solana/dex/types/__init__.py +47 -0
  22. prism_py_sdk-0.4.0/src/prism/api/solana/dex/types/get_swaps_dex_response.py +21 -0
  23. prism_py_sdk-0.4.0/src/prism/api/solana/dex/types/get_trades_dex_response.py +21 -0
  24. prism_py_sdk-0.4.0/src/prism/api/solana/dex/types/search_token_profiles_dex_response.py +21 -0
  25. prism_py_sdk-0.4.0/src/prism/api/solana/dex/types/search_wallet_profiles_dex_response.py +21 -0
  26. prism_py_sdk-0.4.0/src/prism/api/solana/raw_client.py +13 -0
  27. prism_py_sdk-0.4.0/src/prism/api/types/__init__.py +190 -0
  28. prism_py_sdk-0.4.0/src/prism/api/types/bad_request_error_body.py +19 -0
  29. prism_py_sdk-0.4.0/src/prism/api/types/forbidden_error_body.py +19 -0
  30. prism_py_sdk-0.4.0/src/prism/api/types/internal_server_error_body.py +19 -0
  31. prism_py_sdk-0.4.0/src/prism/api/types/paginated_response.py +27 -0
  32. prism_py_sdk-0.4.0/src/prism/api/types/payload_pagination.py +27 -0
  33. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_price.py +23 -0
  34. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_price_candle.py +26 -0
  35. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_price_history.py +21 -0
  36. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_price_snapshot.py +22 -0
  37. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_price_stats.py +106 -0
  38. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_dynamic_labels.py +5 -0
  39. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_dynamic_labels.py +11 -0
  40. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_filter.py +42 -0
  41. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_filter_operators.py +68 -0
  42. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_filter_operators_eq.py +5 -0
  43. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_filter_operators_in_item.py +5 -0
  44. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_filter_operators_ne.py +5 -0
  45. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_filter_operators_nin_item.py +5 -0
  46. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_query.py +41 -0
  47. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_sort.py +29 -0
  48. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_profile_search_payload_sort_direction_enum.py +5 -0
  49. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_protocol_field.py +6 -0
  50. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_swap.py +40 -0
  51. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_swap_type_enum.py +7 -0
  52. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile.py +33 -0
  53. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile_label_enum.py +5 -0
  54. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile_labels.py +7 -0
  55. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile_market.py +27 -0
  56. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile_metadata.py +30 -0
  57. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile_metrics.py +64 -0
  58. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile_payload_options.py +42 -0
  59. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile_search_payload_query_field.py +42 -0
  60. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile_search_payload_query_field_targets_enum.py +7 -0
  61. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_token_profile_time_window_enum.py +5 -0
  62. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_trade.py +44 -0
  63. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_trade_direction_enum.py +5 -0
  64. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_trade_position_state_enum.py +5 -0
  65. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile.py +33 -0
  66. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile_identity.py +21 -0
  67. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile_label_enum.py +7 -0
  68. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile_labels.py +7 -0
  69. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile_metadata.py +20 -0
  70. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile_metrics.py +74 -0
  71. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile_payload_options.py +42 -0
  72. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile_search_payload_query.py +42 -0
  73. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile_search_payload_query_targets_enum.py +8 -0
  74. prism_py_sdk-0.4.0/src/prism/api/types/solana_dex_wallet_profile_time_window_enum.py +5 -0
  75. prism_py_sdk-0.4.0/src/prism/api/types/too_many_requests_error_body.py +19 -0
  76. prism_py_sdk-0.4.0/src/prism/api/types/unauthorized_error_body.py +19 -0
  77. prism_py_sdk-0.4.0/src/prism/client.py +212 -0
  78. prism_py_sdk-0.4.0/src/prism/core/__init__.py +137 -0
  79. prism_py_sdk-0.4.0/src/prism/core/api_error.py +23 -0
  80. prism_py_sdk-0.4.0/src/prism/core/client_wrapper.py +123 -0
  81. prism_py_sdk-0.4.0/src/prism/core/datetime_utils.py +70 -0
  82. prism_py_sdk-0.4.0/src/prism/core/events.py +38 -0
  83. prism_py_sdk-0.4.0/src/prism/core/file.py +67 -0
  84. prism_py_sdk-0.4.0/src/prism/core/force_multipart.py +18 -0
  85. prism_py_sdk-0.4.0/src/prism/core/http_client.py +839 -0
  86. prism_py_sdk-0.4.0/src/prism/core/http_response.py +59 -0
  87. prism_py_sdk-0.4.0/src/prism/core/http_sse/__init__.py +42 -0
  88. prism_py_sdk-0.4.0/src/prism/core/http_sse/_api.py +148 -0
  89. prism_py_sdk-0.4.0/src/prism/core/http_sse/_decoders.py +61 -0
  90. prism_py_sdk-0.4.0/src/prism/core/http_sse/_exceptions.py +7 -0
  91. prism_py_sdk-0.4.0/src/prism/core/http_sse/_models.py +17 -0
  92. prism_py_sdk-0.4.0/src/prism/core/jsonable_encoder.py +120 -0
  93. prism_py_sdk-0.4.0/src/prism/core/logging.py +107 -0
  94. prism_py_sdk-0.4.0/src/prism/core/parse_error.py +36 -0
  95. prism_py_sdk-0.4.0/src/prism/core/pydantic_utilities.py +634 -0
  96. prism_py_sdk-0.4.0/src/prism/core/query_encoder.py +58 -0
  97. prism_py_sdk-0.4.0/src/prism/core/remove_none_from_dict.py +11 -0
  98. prism_py_sdk-0.4.0/src/prism/core/request_options.py +35 -0
  99. prism_py_sdk-0.4.0/src/prism/core/serialization.py +276 -0
  100. prism_py_sdk-0.4.0/src/prism/core/websocket_compat.py +13 -0
  101. prism_py_sdk-0.4.0/src/prism/environment.py +7 -0
  102. prism_py_sdk-0.4.0/src/prism/py.typed +0 -0
  103. prism_py_sdk-0.4.0/src/prism/version.py +3 -0
  104. prism_py_sdk-0.4.0/src/prism/websocket/__init__.py +159 -0
  105. prism_py_sdk-0.4.0/src/prism/websocket/subscription/__init__.py +127 -0
  106. prism_py_sdk-0.4.0/src/prism/websocket/subscription/client.py +165 -0
  107. prism_py_sdk-0.4.0/src/prism/websocket/subscription/raw_client.py +142 -0
  108. prism_py_sdk-0.4.0/src/prism/websocket/subscription/socket_client.py +204 -0
  109. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/__init__.py +125 -0
  110. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_assets_balance_change_message.py +30 -0
  111. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_assets_balance_change_type_enum.py +5 -0
  112. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_assets_transfer_message.py +31 -0
  113. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_assets_transfer_type_enum.py +5 -0
  114. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_pool_message.py +33 -0
  115. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_pool_message_event_type_enum.py +7 -0
  116. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_pool_message_vault.py +21 -0
  117. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_price_message.py +23 -0
  118. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_swap_message.py +43 -0
  119. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_swap_type_enum.py +7 -0
  120. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_token_profile_label_enum.py +5 -0
  121. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_token_profile_market.py +27 -0
  122. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_token_profile_message.py +32 -0
  123. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_token_profile_metadata.py +30 -0
  124. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_token_profile_metrics.py +64 -0
  125. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_trade_direction_enum.py +5 -0
  126. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_trade_message.py +47 -0
  127. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_trade_position_state_enum.py +5 -0
  128. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_wallet_profile_identity.py +21 -0
  129. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_wallet_profile_label_enum.py +7 -0
  130. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_wallet_profile_message.py +32 -0
  131. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_wallet_profile_metadata.py +20 -0
  132. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/solana_dex_wallet_profile_metrics.py +74 -0
  133. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/subscribe_payload.py +24 -0
  134. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/subscribe_payload_params.py +25 -0
  135. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/subscription_message.py +22 -0
  136. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/subscription_message_data.py +23 -0
  137. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/subscription_method_enum.py +5 -0
  138. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/subscription_topic_enum.py +18 -0
  139. prism_py_sdk-0.4.0/src/prism/websocket/subscription/types/unsubscribe_payload.py +25 -0
  140. prism_py_sdk-0.4.0/src/prism/websocket/types/__init__.py +62 -0
  141. prism_py_sdk-0.4.0/src/prism/websocket/types/subscribe_solana_assets_balance_changes_params.py +27 -0
  142. prism_py_sdk-0.4.0/src/prism/websocket/types/subscribe_solana_assets_transfers_params.py +27 -0
  143. prism_py_sdk-0.4.0/src/prism/websocket/types/subscribe_solana_dex_pools_params.py +22 -0
  144. prism_py_sdk-0.4.0/src/prism/websocket/types/subscribe_solana_dex_position_profiles_params.py +22 -0
  145. prism_py_sdk-0.4.0/src/prism/websocket/types/subscribe_solana_dex_prices_params.py +22 -0
  146. prism_py_sdk-0.4.0/src/prism/websocket/types/subscribe_solana_dex_swaps_params.py +27 -0
  147. prism_py_sdk-0.4.0/src/prism/websocket/types/subscribe_solana_dex_token_profiles_params.py +22 -0
  148. prism_py_sdk-0.4.0/src/prism/websocket/types/subscribe_solana_dex_trades_params.py +27 -0
  149. prism_py_sdk-0.4.0/src/prism/websocket/types/subscribe_solana_dex_wallet_profiles_params.py +22 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Prism Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.1
2
+ Name: prism-py-sdk
3
+ Version: 0.4.0
4
+ Summary:
5
+ Requires-Python: >=3.10,<4.0
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: Operating System :: MacOS
8
+ Classifier: Operating System :: Microsoft :: Windows
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Operating System :: POSIX
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Provides-Extra: aiohttp
23
+ Requires-Dist: aiohttp (>=3.13.4,<4) ; (python_version >= "3.9") and (extra == "aiohttp")
24
+ Requires-Dist: httpx (>=0.21.2)
25
+ Requires-Dist: httpx-aiohttp (==0.1.8) ; (python_version >= "3.9") and (extra == "aiohttp")
26
+ Requires-Dist: pydantic (>=1.9.2)
27
+ Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
28
+ Requires-Dist: typing_extensions (>=4.0.0)
29
+ Requires-Dist: websockets (>=12.0)
30
+ Project-URL: Repository, https://github.com/prism-api/sdk-py
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Prism Python Library
34
+
35
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fprism-api%2Fsdk-py)
36
+ [![pypi](https://img.shields.io/pypi/v/prism-py-sdk)](https://pypi.python.org/pypi/prism-py-sdk)
37
+
38
+ The Prism SDKs provide convenient access to the Prism API from your favorite programming language.
39
+
40
+ ## Table of Contents
41
+
42
+ - [Documentation](#documentation)
43
+ - [Installation](#installation)
44
+ - [Reference](#reference)
45
+ - [Usage](#usage)
46
+ - [Environments](#environments)
47
+ - [Async Client](#async-client)
48
+ - [Exception Handling](#exception-handling)
49
+ - [Websockets](#websockets)
50
+ - [Advanced](#advanced)
51
+ - [Access Raw Response Data](#access-raw-response-data)
52
+ - [Retries](#retries)
53
+ - [Timeouts](#timeouts)
54
+ - [Custom Client](#custom-client)
55
+ - [Contributing](#contributing)
56
+
57
+ ## Documentation
58
+
59
+ API reference documentation is available [here](https://docs.prismapi.io/api-reference).
60
+
61
+ ## Installation
62
+
63
+ ```sh
64
+ pip install prism-py-sdk
65
+ ```
66
+
67
+ ## Reference
68
+
69
+ A full reference for this library is available [here](https://github.com/prism-api/sdk-py/blob/HEAD/./reference.md).
70
+
71
+ ## Usage
72
+
73
+ Instantiate and use the client with the following:
74
+
75
+ ```python
76
+ from prism import Client
77
+ from prism.api import SolanaDexWalletProfilePayloadOptions
78
+
79
+ client = Client(
80
+ api_key="<value>",
81
+ )
82
+
83
+ client.api.solana.dex.get_wallet_profile(
84
+ options=SolanaDexWalletProfilePayloadOptions(
85
+ include_metadata=True,
86
+ include_labels=True,
87
+ include_metrics=[
88
+ "7d"
89
+ ],
90
+ ),
91
+ )
92
+ ```
93
+
94
+ ## Environments
95
+
96
+ This SDK allows you to configure different environments for API requests.
97
+
98
+ ```python
99
+ from prism import Client
100
+ from prism.environment import ClientEnvironment
101
+
102
+ client = Client(
103
+ environment=ClientEnvironment.PRODUCTION,
104
+ )
105
+ ```
106
+
107
+ ## Async Client
108
+
109
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
110
+
111
+ ```python
112
+ import asyncio
113
+ from prism.api import SolanaDexWalletProfilePayloadOptions
114
+
115
+ from prism import AsyncClient
116
+
117
+ client = AsyncClient(
118
+ api_key="<value>",
119
+ )
120
+
121
+
122
+ async def main() -> None:
123
+ await client.api.solana.dex.get_wallet_profile(
124
+ options=SolanaDexWalletProfilePayloadOptions(
125
+ include_metadata=True,
126
+ include_labels=True,
127
+ include_metrics=[
128
+ "7d"
129
+ ],
130
+ ),
131
+ )
132
+
133
+
134
+ asyncio.run(main())
135
+ ```
136
+
137
+ ## Exception Handling
138
+
139
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
140
+ will be thrown.
141
+
142
+ ```python
143
+ from prism.core.api_error import ApiError
144
+
145
+ try:
146
+ client.api.solana.dex.get_wallet_profile(...)
147
+ except ApiError as e:
148
+ print(e.status_code)
149
+ print(e.body)
150
+ ```
151
+
152
+ ## Websockets
153
+
154
+ The SDK supports both sync and async websocket connections for real-time, low-latency communication. Sockets can be created using the `connect` method, which returns a context manager.
155
+ You can either iterate through the returned `SocketClient` to process messages as they arrive, or attach handlers to respond to specific events.
156
+
157
+ ```python
158
+ from prism import Client
159
+
160
+ client = Client(...)
161
+
162
+ # Connect to the websocket (Sync)
163
+ with client.subscription.connect(...) as socket:
164
+ # Iterate over the messages as they arrive
165
+ for message in socket:
166
+ print(message)
167
+
168
+ # Or, attach handlers to specific events
169
+ socket.on(EventType.MESSAGE, lambda message: print("received message", message))
170
+
171
+ import asyncio
172
+ from prism import AsyncClient
173
+
174
+ client = AsyncClient(...)
175
+
176
+ # Connect to the websocket (Async)
177
+ async with client.subscription.connect(...) as socket:
178
+ async for message in socket:
179
+ print(message)
180
+ ```
181
+
182
+ ## Advanced
183
+
184
+ ### Access Raw Response Data
185
+
186
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
187
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
188
+
189
+ ```python
190
+ from prism import Client
191
+
192
+ client = Client(...)
193
+ response = client.api.solana.dex.with_raw_response.get_wallet_profile(...)
194
+ print(response.headers) # access the response headers
195
+ print(response.status_code) # access the response status code
196
+ print(response.data) # access the underlying object
197
+ ```
198
+
199
+ ### Retries
200
+
201
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
202
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
203
+ retry limit (default: 2).
204
+
205
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
206
+
207
+ **`legacy`** (current default): retries on
208
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
209
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
210
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
211
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
212
+
213
+ **`recommended`**: retries on
214
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
215
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
216
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
217
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
218
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
219
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
220
+
221
+ Use the `max_retries` request option to configure this behavior.
222
+
223
+ ```python
224
+ client.api.solana.dex.get_wallet_profile(..., request_options={
225
+ "max_retries": 1
226
+ })
227
+ ```
228
+
229
+ ### Timeouts
230
+
231
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
232
+
233
+ ```python
234
+ from prism import Client
235
+
236
+ client = Client(..., timeout=20.0)
237
+
238
+ # Override timeout for a specific method
239
+ client.api.solana.dex.get_wallet_profile(..., request_options={
240
+ "timeout_in_seconds": 1
241
+ })
242
+ ```
243
+
244
+ ### Custom Client
245
+
246
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
247
+ and transports.
248
+
249
+ ```python
250
+ import httpx
251
+ from prism import Client
252
+
253
+ client = Client(
254
+ ...,
255
+ httpx_client=httpx.Client(
256
+ proxy="http://my.test.proxy.example.com",
257
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
258
+ ),
259
+ )
260
+ ```
261
+
262
+ ## Contributing
263
+
264
+ While we value open-source contributions to this SDK, this library is generated programmatically.
265
+ Additions made directly to this library would have to be moved over to our generation code,
266
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
267
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
268
+ an issue first to discuss with us!
269
+
270
+ On the other hand, contributions to the README are always very welcome!
271
+
@@ -0,0 +1,238 @@
1
+ # Prism Python Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fprism-api%2Fsdk-py)
4
+ [![pypi](https://img.shields.io/pypi/v/prism-py-sdk)](https://pypi.python.org/pypi/prism-py-sdk)
5
+
6
+ The Prism SDKs provide convenient access to the Prism API from your favorite programming language.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Documentation](#documentation)
11
+ - [Installation](#installation)
12
+ - [Reference](#reference)
13
+ - [Usage](#usage)
14
+ - [Environments](#environments)
15
+ - [Async Client](#async-client)
16
+ - [Exception Handling](#exception-handling)
17
+ - [Websockets](#websockets)
18
+ - [Advanced](#advanced)
19
+ - [Access Raw Response Data](#access-raw-response-data)
20
+ - [Retries](#retries)
21
+ - [Timeouts](#timeouts)
22
+ - [Custom Client](#custom-client)
23
+ - [Contributing](#contributing)
24
+
25
+ ## Documentation
26
+
27
+ API reference documentation is available [here](https://docs.prismapi.io/api-reference).
28
+
29
+ ## Installation
30
+
31
+ ```sh
32
+ pip install prism-py-sdk
33
+ ```
34
+
35
+ ## Reference
36
+
37
+ A full reference for this library is available [here](https://github.com/prism-api/sdk-py/blob/HEAD/./reference.md).
38
+
39
+ ## Usage
40
+
41
+ Instantiate and use the client with the following:
42
+
43
+ ```python
44
+ from prism import Client
45
+ from prism.api import SolanaDexWalletProfilePayloadOptions
46
+
47
+ client = Client(
48
+ api_key="<value>",
49
+ )
50
+
51
+ client.api.solana.dex.get_wallet_profile(
52
+ options=SolanaDexWalletProfilePayloadOptions(
53
+ include_metadata=True,
54
+ include_labels=True,
55
+ include_metrics=[
56
+ "7d"
57
+ ],
58
+ ),
59
+ )
60
+ ```
61
+
62
+ ## Environments
63
+
64
+ This SDK allows you to configure different environments for API requests.
65
+
66
+ ```python
67
+ from prism import Client
68
+ from prism.environment import ClientEnvironment
69
+
70
+ client = Client(
71
+ environment=ClientEnvironment.PRODUCTION,
72
+ )
73
+ ```
74
+
75
+ ## Async Client
76
+
77
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
78
+
79
+ ```python
80
+ import asyncio
81
+ from prism.api import SolanaDexWalletProfilePayloadOptions
82
+
83
+ from prism import AsyncClient
84
+
85
+ client = AsyncClient(
86
+ api_key="<value>",
87
+ )
88
+
89
+
90
+ async def main() -> None:
91
+ await client.api.solana.dex.get_wallet_profile(
92
+ options=SolanaDexWalletProfilePayloadOptions(
93
+ include_metadata=True,
94
+ include_labels=True,
95
+ include_metrics=[
96
+ "7d"
97
+ ],
98
+ ),
99
+ )
100
+
101
+
102
+ asyncio.run(main())
103
+ ```
104
+
105
+ ## Exception Handling
106
+
107
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
108
+ will be thrown.
109
+
110
+ ```python
111
+ from prism.core.api_error import ApiError
112
+
113
+ try:
114
+ client.api.solana.dex.get_wallet_profile(...)
115
+ except ApiError as e:
116
+ print(e.status_code)
117
+ print(e.body)
118
+ ```
119
+
120
+ ## Websockets
121
+
122
+ The SDK supports both sync and async websocket connections for real-time, low-latency communication. Sockets can be created using the `connect` method, which returns a context manager.
123
+ You can either iterate through the returned `SocketClient` to process messages as they arrive, or attach handlers to respond to specific events.
124
+
125
+ ```python
126
+ from prism import Client
127
+
128
+ client = Client(...)
129
+
130
+ # Connect to the websocket (Sync)
131
+ with client.subscription.connect(...) as socket:
132
+ # Iterate over the messages as they arrive
133
+ for message in socket:
134
+ print(message)
135
+
136
+ # Or, attach handlers to specific events
137
+ socket.on(EventType.MESSAGE, lambda message: print("received message", message))
138
+
139
+ import asyncio
140
+ from prism import AsyncClient
141
+
142
+ client = AsyncClient(...)
143
+
144
+ # Connect to the websocket (Async)
145
+ async with client.subscription.connect(...) as socket:
146
+ async for message in socket:
147
+ print(message)
148
+ ```
149
+
150
+ ## Advanced
151
+
152
+ ### Access Raw Response Data
153
+
154
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
155
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
156
+
157
+ ```python
158
+ from prism import Client
159
+
160
+ client = Client(...)
161
+ response = client.api.solana.dex.with_raw_response.get_wallet_profile(...)
162
+ print(response.headers) # access the response headers
163
+ print(response.status_code) # access the response status code
164
+ print(response.data) # access the underlying object
165
+ ```
166
+
167
+ ### Retries
168
+
169
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
170
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
171
+ retry limit (default: 2).
172
+
173
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
174
+
175
+ **`legacy`** (current default): retries on
176
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
177
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
178
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
179
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
180
+
181
+ **`recommended`**: retries on
182
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
183
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
184
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
185
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
186
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
187
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
188
+
189
+ Use the `max_retries` request option to configure this behavior.
190
+
191
+ ```python
192
+ client.api.solana.dex.get_wallet_profile(..., request_options={
193
+ "max_retries": 1
194
+ })
195
+ ```
196
+
197
+ ### Timeouts
198
+
199
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
200
+
201
+ ```python
202
+ from prism import Client
203
+
204
+ client = Client(..., timeout=20.0)
205
+
206
+ # Override timeout for a specific method
207
+ client.api.solana.dex.get_wallet_profile(..., request_options={
208
+ "timeout_in_seconds": 1
209
+ })
210
+ ```
211
+
212
+ ### Custom Client
213
+
214
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
215
+ and transports.
216
+
217
+ ```python
218
+ import httpx
219
+ from prism import Client
220
+
221
+ client = Client(
222
+ ...,
223
+ httpx_client=httpx.Client(
224
+ proxy="http://my.test.proxy.example.com",
225
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
226
+ ),
227
+ )
228
+ ```
229
+
230
+ ## Contributing
231
+
232
+ While we value open-source contributions to this SDK, this library is generated programmatically.
233
+ Additions made directly to this library would have to be moved over to our generation code,
234
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
235
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
236
+ an issue first to discuss with us!
237
+
238
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,97 @@
1
+ [project]
2
+ name = "prism-py-sdk"
3
+ dynamic = ["version"]
4
+
5
+ [tool.poetry]
6
+ name = "prism-py-sdk"
7
+ version = "0.4.0"
8
+ description = ""
9
+ readme = "README.md"
10
+ authors = []
11
+ keywords = []
12
+
13
+ classifiers = [
14
+ "Intended Audience :: Developers",
15
+ "Programming Language :: Python",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Programming Language :: Python :: 3.15",
23
+ "Operating System :: OS Independent",
24
+ "Operating System :: POSIX",
25
+ "Operating System :: MacOS",
26
+ "Operating System :: POSIX :: Linux",
27
+ "Operating System :: Microsoft :: Windows",
28
+ "Topic :: Software Development :: Libraries :: Python Modules",
29
+ "Typing :: Typed"
30
+ ]
31
+ packages = [
32
+ { include = "prism", from = "src"}
33
+ ]
34
+
35
+ [tool.poetry.urls]
36
+ Repository = 'https://github.com/prism-api/sdk-py'
37
+
38
+ [tool.poetry.dependencies]
39
+ python = "^3.10"
40
+ aiohttp = { version = ">=3.13.4,<4", optional = true, python = ">=3.9"}
41
+ httpx = ">=0.21.2"
42
+ httpx-aiohttp = { version = "0.1.8", optional = true, python = ">=3.9"}
43
+ pydantic = ">= 1.9.2"
44
+ pydantic-core = ">=2.18.2,<3.0.0"
45
+ typing_extensions = ">= 4.0.0"
46
+ websockets = ">=12.0"
47
+
48
+ [tool.poetry.group.dev.dependencies]
49
+ mypy = "==1.13.0"
50
+ pytest = "^9.0.3"
51
+ pytest-asyncio = "^1.0.0"
52
+ pytest-xdist = "^3.6.1"
53
+ python-dateutil = "^2.9.0"
54
+ types-python-dateutil = "^2.9.0.20240316"
55
+ urllib3 = ">=2.6.3,<3.0.0"
56
+ ruff = "==0.11.5"
57
+
58
+ [tool.pytest.ini_options]
59
+ testpaths = [ "tests" ]
60
+ asyncio_mode = "auto"
61
+ markers = [
62
+ "aiohttp: tests that require httpx_aiohttp to be installed",
63
+ ]
64
+
65
+ [tool.mypy]
66
+ plugins = ["pydantic.mypy"]
67
+
68
+ [tool.ruff]
69
+ line-length = 120
70
+
71
+ [tool.ruff.lint]
72
+ select = [
73
+ "E", # pycodestyle errors
74
+ "F", # pyflakes
75
+ "I", # isort
76
+ ]
77
+ ignore = [
78
+ "E402", # Module level import not at top of file
79
+ "E501", # Line too long
80
+ "E711", # Comparison to `None` should be `cond is not None`
81
+ "E712", # Avoid equality comparisons to `True`; use `if ...:` checks
82
+ "E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks
83
+ "E722", # Do not use bare `except`
84
+ "E731", # Do not assign a `lambda` expression, use a `def`
85
+ "F821", # Undefined name
86
+ "F841" # Local variable ... is assigned to but never used
87
+ ]
88
+
89
+ [tool.ruff.lint.isort]
90
+ section-order = ["future", "standard-library", "third-party", "first-party"]
91
+
92
+ [build-system]
93
+ requires = ["poetry-core"]
94
+ build-backend = "poetry.core.masonry.api"
95
+
96
+ [tool.poetry.extras]
97
+ aiohttp=["aiohttp", "httpx-aiohttp"]
@@ -0,0 +1,56 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from . import api, websocket
10
+ from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient
11
+ from .client import AsyncClient, Client
12
+ from .environment import ClientEnvironment
13
+ from .version import __version__
14
+ _dynamic_imports: typing.Dict[str, str] = {
15
+ "AsyncClient": ".client",
16
+ "Client": ".client",
17
+ "ClientEnvironment": ".environment",
18
+ "DefaultAioHttpClient": "._default_clients",
19
+ "DefaultAsyncHttpxClient": "._default_clients",
20
+ "__version__": ".version",
21
+ "api": ".api",
22
+ "websocket": ".websocket",
23
+ }
24
+
25
+
26
+ def __getattr__(attr_name: str) -> typing.Any:
27
+ module_name = _dynamic_imports.get(attr_name)
28
+ if module_name is None:
29
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
30
+ try:
31
+ module = import_module(module_name, __package__)
32
+ if module_name == f".{attr_name}":
33
+ return module
34
+ else:
35
+ return getattr(module, attr_name)
36
+ except ImportError as e:
37
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
38
+ except AttributeError as e:
39
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
40
+
41
+
42
+ def __dir__():
43
+ lazy_attrs = list(_dynamic_imports.keys())
44
+ return sorted(lazy_attrs)
45
+
46
+
47
+ __all__ = [
48
+ "AsyncClient",
49
+ "Client",
50
+ "ClientEnvironment",
51
+ "DefaultAioHttpClient",
52
+ "DefaultAsyncHttpxClient",
53
+ "__version__",
54
+ "api",
55
+ "websocket",
56
+ ]