polivor 0.1.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 (140) hide show
  1. polivor-0.1.0/LICENSE +202 -0
  2. polivor-0.1.0/NOTICE +4 -0
  3. polivor-0.1.0/PKG-INFO +46 -0
  4. polivor-0.1.0/README.md +28 -0
  5. polivor-0.1.0/polivor/__init__.py +4 -0
  6. polivor-0.1.0/polivor/client.py +14 -0
  7. polivor-0.1.0/polivor/generated/__init__.py +8 -0
  8. polivor-0.1.0/polivor/generated/api/__init__.py +1 -0
  9. polivor-0.1.0/polivor/generated/api/authorization/__init__.py +1 -0
  10. polivor-0.1.0/polivor/generated/api/authorization/mark_not_executed.py +213 -0
  11. polivor-0.1.0/polivor/generated/api/authorization/report_execution.py +244 -0
  12. polivor-0.1.0/polivor/generated/api/authorize/__init__.py +1 -0
  13. polivor-0.1.0/polivor/generated/api/authorize/authorize.py +271 -0
  14. polivor-0.1.0/polivor/generated/api/authorize/get_decision.py +194 -0
  15. polivor-0.1.0/polivor/generated/api/authorize/simulate.py +218 -0
  16. polivor-0.1.0/polivor/generated/api/beneficiary/__init__.py +1 -0
  17. polivor-0.1.0/polivor/generated/api/beneficiary/create_beneficiary.py +210 -0
  18. polivor-0.1.0/polivor/generated/api/beneficiary/list_beneficiaries.py +166 -0
  19. polivor-0.1.0/polivor/generated/api/beneficiary/update_beneficiary.py +224 -0
  20. polivor-0.1.0/polivor/generated/api/evidence/__init__.py +1 -0
  21. polivor-0.1.0/polivor/generated/api/evidence/export_evidence.py +225 -0
  22. polivor-0.1.0/polivor/generated/api/evidence/get_jwks.py +150 -0
  23. polivor-0.1.0/polivor/generated/api/evidence/list_evidence.py +211 -0
  24. polivor-0.1.0/polivor/generated/api/identity/__init__.py +1 -0
  25. polivor-0.1.0/polivor/generated/api/identity/create_agent.py +203 -0
  26. polivor-0.1.0/polivor/generated/api/identity/create_principal.py +203 -0
  27. polivor-0.1.0/polivor/generated/api/identity/list_agents.py +166 -0
  28. polivor-0.1.0/polivor/generated/api/identity/register_agent_version.py +231 -0
  29. polivor-0.1.0/polivor/generated/api/identity/suspend_agent.py +190 -0
  30. polivor-0.1.0/polivor/generated/api/keys/__init__.py +1 -0
  31. polivor-0.1.0/polivor/generated/api/keys/create_api_key.py +207 -0
  32. polivor-0.1.0/polivor/generated/api/keys/list_api_keys.py +170 -0
  33. polivor-0.1.0/polivor/generated/api/keys/revoke_api_key.py +205 -0
  34. polivor-0.1.0/polivor/generated/api/mandate/__init__.py +1 -0
  35. polivor-0.1.0/polivor/generated/api/mandate/activate_mandate.py +204 -0
  36. polivor-0.1.0/polivor/generated/api/mandate/create_mandate.py +215 -0
  37. polivor-0.1.0/polivor/generated/api/mandate/create_mandate_version.py +243 -0
  38. polivor-0.1.0/polivor/generated/api/mandate/get_mandate.py +220 -0
  39. polivor-0.1.0/polivor/generated/api/mandate/import_ap_2_mandate.py +313 -0
  40. polivor-0.1.0/polivor/generated/api/mandate/list_mandates.py +166 -0
  41. polivor-0.1.0/polivor/generated/api/mandate/list_trusted_issuers.py +166 -0
  42. polivor-0.1.0/polivor/generated/api/mandate/register_trusted_issuer.py +235 -0
  43. polivor-0.1.0/polivor/generated/api/mandate/resume_mandate.py +197 -0
  44. polivor-0.1.0/polivor/generated/api/mandate/revoke_mandate.py +201 -0
  45. polivor-0.1.0/polivor/generated/api/mandate/suspend_mandate.py +197 -0
  46. polivor-0.1.0/polivor/generated/api/mcp/__init__.py +1 -0
  47. polivor-0.1.0/polivor/generated/api/mcp/mcp_message.py +281 -0
  48. polivor-0.1.0/polivor/generated/api/policy/__init__.py +1 -0
  49. polivor-0.1.0/polivor/generated/api/policy/create_policy.py +211 -0
  50. polivor-0.1.0/polivor/generated/api/policy/list_policies.py +166 -0
  51. polivor-0.1.0/polivor/generated/api/policy/publish_policy.py +207 -0
  52. polivor-0.1.0/polivor/generated/api/webhook/__init__.py +1 -0
  53. polivor-0.1.0/polivor/generated/api/webhook/get_webhook.py +165 -0
  54. polivor-0.1.0/polivor/generated/api/webhook/remove_webhook.py +161 -0
  55. polivor-0.1.0/polivor/generated/api/webhook/set_webhook.py +251 -0
  56. polivor-0.1.0/polivor/generated/client.py +271 -0
  57. polivor-0.1.0/polivor/generated/errors.py +14 -0
  58. polivor-0.1.0/polivor/generated/models/__init__.py +145 -0
  59. polivor-0.1.0/polivor/generated/models/action.py +141 -0
  60. polivor-0.1.0/polivor/generated/models/action_payment_type.py +8 -0
  61. polivor-0.1.0/polivor/generated/models/agent.py +141 -0
  62. polivor-0.1.0/polivor/generated/models/agent_create.py +86 -0
  63. polivor-0.1.0/polivor/generated/models/agent_status.py +9 -0
  64. polivor-0.1.0/polivor/generated/models/ap_2_import_result.py +98 -0
  65. polivor-0.1.0/polivor/generated/models/ap_2_import_result_report.py +102 -0
  66. polivor-0.1.0/polivor/generated/models/api_key.py +168 -0
  67. polivor-0.1.0/polivor/generated/models/api_key_create.py +84 -0
  68. polivor-0.1.0/polivor/generated/models/api_key_create_role.py +9 -0
  69. polivor-0.1.0/polivor/generated/models/api_key_created.py +100 -0
  70. polivor-0.1.0/polivor/generated/models/api_key_created_role.py +9 -0
  71. polivor-0.1.0/polivor/generated/models/api_key_role.py +9 -0
  72. polivor-0.1.0/polivor/generated/models/authorization_artifact.py +101 -0
  73. polivor-0.1.0/polivor/generated/models/authorization_status.py +149 -0
  74. polivor-0.1.0/polivor/generated/models/authorization_status_status.py +11 -0
  75. polivor-0.1.0/polivor/generated/models/authorize_request.py +130 -0
  76. polivor-0.1.0/polivor/generated/models/authorize_response.py +217 -0
  77. polivor-0.1.0/polivor/generated/models/authorize_response_evidence.py +89 -0
  78. polivor-0.1.0/polivor/generated/models/authorize_response_mandate.py +88 -0
  79. polivor-0.1.0/polivor/generated/models/authorize_response_outcome.py +9 -0
  80. polivor-0.1.0/polivor/generated/models/beneficiary.py +124 -0
  81. polivor-0.1.0/polivor/generated/models/beneficiary_create.py +104 -0
  82. polivor-0.1.0/polivor/generated/models/beneficiary_create_status.py +8 -0
  83. polivor-0.1.0/polivor/generated/models/beneficiary_ref.py +96 -0
  84. polivor-0.1.0/polivor/generated/models/beneficiary_status.py +8 -0
  85. polivor-0.1.0/polivor/generated/models/beneficiary_update.py +99 -0
  86. polivor-0.1.0/polivor/generated/models/beneficiary_update_status.py +8 -0
  87. polivor-0.1.0/polivor/generated/models/check.py +113 -0
  88. polivor-0.1.0/polivor/generated/models/check_detail.py +64 -0
  89. polivor-0.1.0/polivor/generated/models/check_result.py +10 -0
  90. polivor-0.1.0/polivor/generated/models/decision_status.py +157 -0
  91. polivor-0.1.0/polivor/generated/models/decision_status_outcome.py +9 -0
  92. polivor-0.1.0/polivor/generated/models/decision_status_status.py +9 -0
  93. polivor-0.1.0/polivor/generated/models/evidence_bundle.py +188 -0
  94. polivor-0.1.0/polivor/generated/models/evidence_bundle_authorizations_item.py +112 -0
  95. polivor-0.1.0/polivor/generated/models/evidence_row.py +156 -0
  96. polivor-0.1.0/polivor/generated/models/evidence_row_payload.py +66 -0
  97. polivor-0.1.0/polivor/generated/models/execution_report.py +72 -0
  98. polivor-0.1.0/polivor/generated/models/execution_report_status.py +9 -0
  99. polivor-0.1.0/polivor/generated/models/import_ap_2_mandate_body.py +123 -0
  100. polivor-0.1.0/polivor/generated/models/json_rpc_message.py +179 -0
  101. polivor-0.1.0/polivor/generated/models/json_rpc_message_error.py +84 -0
  102. polivor-0.1.0/polivor/generated/models/json_rpc_message_params.py +64 -0
  103. polivor-0.1.0/polivor/generated/models/json_rpc_message_result.py +64 -0
  104. polivor-0.1.0/polivor/generated/models/jwk.py +164 -0
  105. polivor-0.1.0/polivor/generated/models/jwk_use.py +8 -0
  106. polivor-0.1.0/polivor/generated/models/jwks.py +94 -0
  107. polivor-0.1.0/polivor/generated/models/mandate.py +168 -0
  108. polivor-0.1.0/polivor/generated/models/mandate_body.py +81 -0
  109. polivor-0.1.0/polivor/generated/models/mandate_source.py +8 -0
  110. polivor-0.1.0/polivor/generated/models/mandate_status.py +10 -0
  111. polivor-0.1.0/polivor/generated/models/mcp_message_mcp_protocol_version.py +9 -0
  112. polivor-0.1.0/polivor/generated/models/policy_version.py +197 -0
  113. polivor-0.1.0/polivor/generated/models/policy_version_status.py +9 -0
  114. polivor-0.1.0/polivor/generated/models/principal.py +106 -0
  115. polivor-0.1.0/polivor/generated/models/principal_create.py +76 -0
  116. polivor-0.1.0/polivor/generated/models/problem.py +149 -0
  117. polivor-0.1.0/polivor/generated/models/problem_errors_item.py +103 -0
  118. polivor-0.1.0/polivor/generated/models/register_agent_version_body.py +58 -0
  119. polivor-0.1.0/polivor/generated/models/signals.py +94 -0
  120. polivor-0.1.0/polivor/generated/models/simulate_request.py +137 -0
  121. polivor-0.1.0/polivor/generated/models/simulate_response.py +171 -0
  122. polivor-0.1.0/polivor/generated/models/simulate_response_mandate.py +88 -0
  123. polivor-0.1.0/polivor/generated/models/simulate_response_outcome.py +9 -0
  124. polivor-0.1.0/polivor/generated/models/template_params.py +146 -0
  125. polivor-0.1.0/polivor/generated/models/trusted_issuer.py +133 -0
  126. polivor-0.1.0/polivor/generated/models/webhook_configured.py +84 -0
  127. polivor-0.1.0/polivor/generated/models/webhook_set.py +58 -0
  128. polivor-0.1.0/polivor/generated/models/webhook_status.py +99 -0
  129. polivor-0.1.0/polivor/generated/py.typed +1 -0
  130. polivor-0.1.0/polivor/generated/types.py +53 -0
  131. polivor-0.1.0/polivor/py.typed +0 -0
  132. polivor-0.1.0/polivor/verify.py +20 -0
  133. polivor-0.1.0/polivor.egg-info/PKG-INFO +46 -0
  134. polivor-0.1.0/polivor.egg-info/SOURCES.txt +138 -0
  135. polivor-0.1.0/polivor.egg-info/dependency_links.txt +1 -0
  136. polivor-0.1.0/polivor.egg-info/requires.txt +4 -0
  137. polivor-0.1.0/polivor.egg-info/top_level.txt +1 -0
  138. polivor-0.1.0/pyproject.toml +31 -0
  139. polivor-0.1.0/setup.cfg +4 -0
  140. polivor-0.1.0/tests/test_client.py +83 -0
polivor-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
polivor-0.1.0/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Polivor python SDK
2
+ Copyright 2026 Polivor
3
+
4
+ This product includes software developed at Polivor (https://polivor.com).
polivor-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: polivor
3
+ Version: 0.1.0
4
+ Summary: Python client for the Polivor API, generated from its OpenAPI file.
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://polivor.com/docs
7
+ Project-URL: Repository, https://github.com/Polivor/polivor-sdk-python
8
+ Project-URL: Issues, https://github.com/Polivor/polivor-sdk-python/issues
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Requires-Dist: httpx<0.29.0,>=0.23.1
14
+ Requires-Dist: attrs>=22.2.0
15
+ Requires-Dist: python-dateutil>=2.8.0
16
+ Requires-Dist: PyJWT[crypto]<3,>=2.10.1
17
+ Dynamic: license-file
18
+
19
+ # polivor
20
+
21
+ [![ci](https://github.com/Polivor/polivor-sdk-python/actions/workflows/ci.yml/badge.svg)](https://github.com/Polivor/polivor-sdk-python/actions/workflows/ci.yml) [![license](https://img.shields.io/github/license/Polivor/polivor-sdk-python)](LICENSE) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Polivor/polivor-sdk-python/badge)](https://scorecard.dev/viewer/?uri=github.com/Polivor/polivor-sdk-python)
22
+
23
+ Python client for the Polivor API, generated from its OpenAPI file. The package holds no keys or secrets: you bring your own API key.
24
+
25
+ ```python
26
+ from polivor import create_client, verify_authorization
27
+ from polivor.generated.api.authorize import authorize
28
+
29
+ client = create_client() # reads POLIVOR_API_KEY, or pass api_key="..."
30
+ result = authorize.sync(client=client, body=body, idempotency_key=key)
31
+
32
+ # Enforcement point: no API key needed, only Polivor's public keys.
33
+ claims = verify_authorization(result.authorization.jws, audience="your-enforcement-point")
34
+ ```
35
+
36
+ - Keys have a role: `agent` (ask for authority), `enforcer` (report execution), `admin` (manage). Give each component only its own role, and never put an `admin` key in browser or mobile code.
37
+ - Keys starting with `pv_test_` are sandbox keys. Polivor decides and records; it never moves money.
38
+ - Base URLs: `PRODUCTION_BASE_URL`, `STAGING_BASE_URL`; pass `base_url` to choose.
39
+
40
+ ## Development
41
+
42
+ `openapi/polivor.yaml` is a copy of the published API description. A scheduled workflow refreshes it and opens a pull request when it changes. Generated code is never edited by hand.
43
+
44
+ ## License
45
+
46
+ Apache-2.0, see [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,28 @@
1
+ # polivor
2
+
3
+ [![ci](https://github.com/Polivor/polivor-sdk-python/actions/workflows/ci.yml/badge.svg)](https://github.com/Polivor/polivor-sdk-python/actions/workflows/ci.yml) [![license](https://img.shields.io/github/license/Polivor/polivor-sdk-python)](LICENSE) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Polivor/polivor-sdk-python/badge)](https://scorecard.dev/viewer/?uri=github.com/Polivor/polivor-sdk-python)
4
+
5
+ Python client for the Polivor API, generated from its OpenAPI file. The package holds no keys or secrets: you bring your own API key.
6
+
7
+ ```python
8
+ from polivor import create_client, verify_authorization
9
+ from polivor.generated.api.authorize import authorize
10
+
11
+ client = create_client() # reads POLIVOR_API_KEY, or pass api_key="..."
12
+ result = authorize.sync(client=client, body=body, idempotency_key=key)
13
+
14
+ # Enforcement point: no API key needed, only Polivor's public keys.
15
+ claims = verify_authorization(result.authorization.jws, audience="your-enforcement-point")
16
+ ```
17
+
18
+ - Keys have a role: `agent` (ask for authority), `enforcer` (report execution), `admin` (manage). Give each component only its own role, and never put an `admin` key in browser or mobile code.
19
+ - Keys starting with `pv_test_` are sandbox keys. Polivor decides and records; it never moves money.
20
+ - Base URLs: `PRODUCTION_BASE_URL`, `STAGING_BASE_URL`; pass `base_url` to choose.
21
+
22
+ ## Development
23
+
24
+ `openapi/polivor.yaml` is a copy of the published API description. A scheduled workflow refreshes it and opens a pull request when it changes. Generated code is never edited by hand.
25
+
26
+ ## License
27
+
28
+ Apache-2.0, see [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,4 @@
1
+ from .client import API_KEY_ENVIRONMENT_VARIABLE, PRODUCTION_BASE_URL, STAGING_BASE_URL, create_client
2
+ from .verify import verify_authorization
3
+
4
+ __all__ = ("API_KEY_ENVIRONMENT_VARIABLE", "PRODUCTION_BASE_URL", "STAGING_BASE_URL", "create_client", "verify_authorization")
@@ -0,0 +1,14 @@
1
+ import os
2
+
3
+ from .generated import AuthenticatedClient
4
+
5
+ PRODUCTION_BASE_URL = "https://api.polivor.com"
6
+ STAGING_BASE_URL = "https://api.staging.polivor.com"
7
+ API_KEY_ENVIRONMENT_VARIABLE = "POLIVOR_API_KEY"
8
+
9
+
10
+ def create_client(api_key: str | None = None, base_url: str = PRODUCTION_BASE_URL) -> AuthenticatedClient:
11
+ resolved_key = api_key or os.environ.get(API_KEY_ENVIRONMENT_VARIABLE)
12
+ if not resolved_key:
13
+ raise ValueError(f"Polivor API key missing: pass api_key or set {API_KEY_ENVIRONMENT_VARIABLE}")
14
+ return AuthenticatedClient(base_url=base_url, token=resolved_key)
@@ -0,0 +1,8 @@
1
+
2
+ """ A client library for accessing Polivor Authority API """
3
+ from .client import AuthenticatedClient, Client
4
+
5
+ __all__ = (
6
+ "AuthenticatedClient",
7
+ "Client",
8
+ )
@@ -0,0 +1 @@
1
+ """ Contains methods for accessing the API """
@@ -0,0 +1 @@
1
+ """ Contains endpoint functions for accessing the API """
@@ -0,0 +1,213 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, cast
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...types import Response, UNSET
9
+ from ... import errors
10
+
11
+ from ...models.authorization_status import AuthorizationStatus
12
+ from ...models.problem import Problem
13
+ from typing import cast
14
+ from uuid import UUID
15
+
16
+
17
+
18
+ def _get_kwargs(
19
+ id: UUID,
20
+
21
+ ) -> dict[str, Any]:
22
+
23
+
24
+
25
+
26
+
27
+
28
+ _kwargs: dict[str, Any] = {
29
+ "method": "post",
30
+ "url": "/v1/authorizations/{id}/not-executed".format(id=quote(str(id), safe=""),),
31
+ }
32
+
33
+
34
+ return _kwargs
35
+
36
+
37
+
38
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AuthorizationStatus | Problem | None:
39
+ if response.status_code == 200:
40
+ response_200 = AuthorizationStatus.from_dict(response.json())
41
+
42
+
43
+
44
+ return response_200
45
+
46
+ if response.status_code == 401:
47
+ response_401 = Problem.from_dict(response.json())
48
+
49
+
50
+
51
+ return response_401
52
+
53
+ if response.status_code == 403:
54
+ response_403 = Problem.from_dict(response.json())
55
+
56
+
57
+
58
+ return response_403
59
+
60
+ if response.status_code == 404:
61
+ response_404 = Problem.from_dict(response.json())
62
+
63
+
64
+
65
+ return response_404
66
+
67
+ if response.status_code == 409:
68
+ response_409 = Problem.from_dict(response.json())
69
+
70
+
71
+
72
+ return response_409
73
+
74
+ if client.raise_on_unexpected_status:
75
+ raise errors.UnexpectedStatus(response.status_code, response.content)
76
+ else:
77
+ return None
78
+
79
+
80
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AuthorizationStatus | Problem]:
81
+ return Response(
82
+ status_code=HTTPStatus(response.status_code),
83
+ content=response.content,
84
+ headers=response.headers,
85
+ parsed=_parse_response(client=client, response=response),
86
+ )
87
+
88
+
89
+ def sync_detailed(
90
+ id: UUID,
91
+ *,
92
+ client: AuthenticatedClient | Client,
93
+
94
+ ) -> Response[AuthorizationStatus | Problem]:
95
+ """ Release an unreported authorization and its reserved budget (role admin)
96
+
97
+ Only after the authorization has expired (409 AUTHORIZATION_STILL_VALID before), because until then
98
+ the enforcement point could still use it.
99
+
100
+ Args:
101
+ id (UUID):
102
+
103
+ Raises:
104
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
105
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
106
+
107
+ Returns:
108
+ Response[AuthorizationStatus | Problem]
109
+ """
110
+
111
+
112
+ kwargs = _get_kwargs(
113
+ id=id,
114
+
115
+ )
116
+
117
+ response = client.get_httpx_client().request(
118
+ **kwargs,
119
+ )
120
+
121
+ return _build_response(client=client, response=response)
122
+
123
+ def sync(
124
+ id: UUID,
125
+ *,
126
+ client: AuthenticatedClient | Client,
127
+
128
+ ) -> AuthorizationStatus | Problem | None:
129
+ """ Release an unreported authorization and its reserved budget (role admin)
130
+
131
+ Only after the authorization has expired (409 AUTHORIZATION_STILL_VALID before), because until then
132
+ the enforcement point could still use it.
133
+
134
+ Args:
135
+ id (UUID):
136
+
137
+ Raises:
138
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
139
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
140
+
141
+ Returns:
142
+ AuthorizationStatus | Problem
143
+ """
144
+
145
+
146
+ return sync_detailed(
147
+ id=id,
148
+ client=client,
149
+
150
+ ).parsed
151
+
152
+ async def asyncio_detailed(
153
+ id: UUID,
154
+ *,
155
+ client: AuthenticatedClient | Client,
156
+
157
+ ) -> Response[AuthorizationStatus | Problem]:
158
+ """ Release an unreported authorization and its reserved budget (role admin)
159
+
160
+ Only after the authorization has expired (409 AUTHORIZATION_STILL_VALID before), because until then
161
+ the enforcement point could still use it.
162
+
163
+ Args:
164
+ id (UUID):
165
+
166
+ Raises:
167
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
168
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
169
+
170
+ Returns:
171
+ Response[AuthorizationStatus | Problem]
172
+ """
173
+
174
+
175
+ kwargs = _get_kwargs(
176
+ id=id,
177
+
178
+ )
179
+
180
+ response = await client.get_async_httpx_client().request(
181
+ **kwargs
182
+ )
183
+
184
+ return _build_response(client=client, response=response)
185
+
186
+ async def asyncio(
187
+ id: UUID,
188
+ *,
189
+ client: AuthenticatedClient | Client,
190
+
191
+ ) -> AuthorizationStatus | Problem | None:
192
+ """ Release an unreported authorization and its reserved budget (role admin)
193
+
194
+ Only after the authorization has expired (409 AUTHORIZATION_STILL_VALID before), because until then
195
+ the enforcement point could still use it.
196
+
197
+ Args:
198
+ id (UUID):
199
+
200
+ Raises:
201
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
202
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
203
+
204
+ Returns:
205
+ AuthorizationStatus | Problem
206
+ """
207
+
208
+
209
+ return (await asyncio_detailed(
210
+ id=id,
211
+ client=client,
212
+
213
+ )).parsed