grepvine 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.
- grepvine-0.1.0/.gitignore +11 -0
- grepvine-0.1.0/LICENSE +202 -0
- grepvine-0.1.0/NOTICE +2 -0
- grepvine-0.1.0/PKG-INFO +464 -0
- grepvine-0.1.0/README.md +439 -0
- grepvine-0.1.0/pyproject.toml +59 -0
- grepvine-0.1.0/src/grepvine/__init__.py +65 -0
- grepvine-0.1.0/src/grepvine/_client.py +159 -0
- grepvine-0.1.0/src/grepvine/_generated/__init__.py +8 -0
- grepvine-0.1.0/src/grepvine/_generated/api/__init__.py +1 -0
- grepvine-0.1.0/src/grepvine/_generated/api/api_keys/__init__.py +1 -0
- grepvine-0.1.0/src/grepvine/_generated/api/api_keys/create_api_key.py +160 -0
- grepvine-0.1.0/src/grepvine/_generated/api/api_keys/list_api_keys.py +176 -0
- grepvine-0.1.0/src/grepvine/_generated/api/api_keys/revoke_api_key.py +159 -0
- grepvine-0.1.0/src/grepvine/_generated/api/authentication/__init__.py +1 -0
- grepvine-0.1.0/src/grepvine/_generated/api/authentication/change_password.py +163 -0
- grepvine-0.1.0/src/grepvine/_generated/api/authentication/check_invitation.py +177 -0
- grepvine-0.1.0/src/grepvine/_generated/api/authentication/get_auth_options.py +140 -0
- grepvine-0.1.0/src/grepvine/_generated/api/authentication/get_current_user.py +133 -0
- grepvine-0.1.0/src/grepvine/_generated/api/authentication/get_username_availability.py +163 -0
- grepvine-0.1.0/src/grepvine/_generated/api/authentication/login.py +165 -0
- grepvine-0.1.0/src/grepvine/_generated/api/authentication/logout.py +126 -0
- grepvine-0.1.0/src/grepvine/_generated/api/authentication/register_user.py +198 -0
- grepvine-0.1.0/src/grepvine/_generated/api/device_login/__init__.py +1 -0
- grepvine-0.1.0/src/grepvine/_generated/api/device_login/approve_device_authorization.py +163 -0
- grepvine-0.1.0/src/grepvine/_generated/api/device_login/deny_device_authorization.py +163 -0
- grepvine-0.1.0/src/grepvine/_generated/api/device_login/poll_device_token.py +165 -0
- grepvine-0.1.0/src/grepvine/_generated/api/device_login/start_device_authorization.py +160 -0
- grepvine-0.1.0/src/grepvine/_generated/api/indexes/__init__.py +1 -0
- grepvine-0.1.0/src/grepvine/_generated/api/indexes/create_index.py +189 -0
- grepvine-0.1.0/src/grepvine/_generated/api/indexes/delete_index.py +188 -0
- grepvine-0.1.0/src/grepvine/_generated/api/indexes/get_index.py +190 -0
- grepvine-0.1.0/src/grepvine/_generated/api/indexes/list_indexes.py +215 -0
- grepvine-0.1.0/src/grepvine/_generated/api/indexes/update_index.py +227 -0
- grepvine-0.1.0/src/grepvine/_generated/api/objects/__init__.py +1 -0
- grepvine-0.1.0/src/grepvine/_generated/api/objects/delete_document.py +244 -0
- grepvine-0.1.0/src/grepvine/_generated/api/objects/delete_objects.py +238 -0
- grepvine-0.1.0/src/grepvine/_generated/api/objects/get_document.py +234 -0
- grepvine-0.1.0/src/grepvine/_generated/api/objects/list_documents.py +252 -0
- grepvine-0.1.0/src/grepvine/_generated/api/objects/put_document.py +285 -0
- grepvine-0.1.0/src/grepvine/_generated/api/objects/put_objects.py +266 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/__init__.py +1 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/add_organization_member.py +184 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/create_organization.py +165 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/delete_organization.py +166 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/get_organization.py +168 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/list_organization_members.py +200 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/list_organizations.py +176 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/remove_organization_member.py +183 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/transfer_organization_ownership.py +182 -0
- grepvine-0.1.0/src/grepvine/_generated/api/organizations/update_organization_member.py +206 -0
- grepvine-0.1.0/src/grepvine/_generated/api/resources.py +2365 -0
- grepvine-0.1.0/src/grepvine/_generated/api/search/__init__.py +1 -0
- grepvine-0.1.0/src/grepvine/_generated/api/search/query_index.py +242 -0
- grepvine-0.1.0/src/grepvine/_generated/client.py +272 -0
- grepvine-0.1.0/src/grepvine/_generated/errors.py +16 -0
- grepvine-0.1.0/src/grepvine/_generated/models/__init__.py +129 -0
- grepvine-0.1.0/src/grepvine/_generated/models/add_member_request.py +56 -0
- grepvine-0.1.0/src/grepvine/_generated/models/add_member_request_role.py +10 -0
- grepvine-0.1.0/src/grepvine/_generated/models/api_key.py +104 -0
- grepvine-0.1.0/src/grepvine/_generated/models/api_key_created.py +131 -0
- grepvine-0.1.0/src/grepvine/_generated/models/api_key_page.py +69 -0
- grepvine-0.1.0/src/grepvine/_generated/models/auth_options.py +47 -0
- grepvine-0.1.0/src/grepvine/_generated/models/change_password_request.py +51 -0
- grepvine-0.1.0/src/grepvine/_generated/models/context_line.py +61 -0
- grepvine-0.1.0/src/grepvine/_generated/models/create_api_key_request.py +43 -0
- grepvine-0.1.0/src/grepvine/_generated/models/create_index_request.py +80 -0
- grepvine-0.1.0/src/grepvine/_generated/models/create_organization_request.py +45 -0
- grepvine-0.1.0/src/grepvine/_generated/models/delete_object_record.py +54 -0
- grepvine-0.1.0/src/grepvine/_generated/models/delete_objects_request.py +57 -0
- grepvine-0.1.0/src/grepvine/_generated/models/device_authorization.py +83 -0
- grepvine-0.1.0/src/grepvine/_generated/models/device_authorization_request.py +43 -0
- grepvine-0.1.0/src/grepvine/_generated/models/device_decision_request.py +43 -0
- grepvine-0.1.0/src/grepvine/_generated/models/device_token_request.py +43 -0
- grepvine-0.1.0/src/grepvine/_generated/models/document_page.py +79 -0
- grepvine-0.1.0/src/grepvine/_generated/models/document_summary.py +92 -0
- grepvine-0.1.0/src/grepvine/_generated/models/error.py +59 -0
- grepvine-0.1.0/src/grepvine/_generated/models/index.py +178 -0
- grepvine-0.1.0/src/grepvine/_generated/models/index_page.py +69 -0
- grepvine-0.1.0/src/grepvine/_generated/models/index_state.py +11 -0
- grepvine-0.1.0/src/grepvine/_generated/models/index_summary.py +149 -0
- grepvine-0.1.0/src/grepvine/_generated/models/index_tag_changes.py +64 -0
- grepvine-0.1.0/src/grepvine/_generated/models/index_tags.py +52 -0
- grepvine-0.1.0/src/grepvine/_generated/models/invitation_check_request.py +43 -0
- grepvine-0.1.0/src/grepvine/_generated/models/invitation_preview.py +83 -0
- grepvine-0.1.0/src/grepvine/_generated/models/invitation_role.py +10 -0
- grepvine-0.1.0/src/grepvine/_generated/models/login_request.py +51 -0
- grepvine-0.1.0/src/grepvine/_generated/models/match.py +51 -0
- grepvine-0.1.0/src/grepvine/_generated/models/member.py +86 -0
- grepvine-0.1.0/src/grepvine/_generated/models/member_page.py +69 -0
- grepvine-0.1.0/src/grepvine/_generated/models/metadata.py +194 -0
- grepvine-0.1.0/src/grepvine/_generated/models/mutation_batch_result.py +57 -0
- grepvine-0.1.0/src/grepvine/_generated/models/mutation_result.py +78 -0
- grepvine-0.1.0/src/grepvine/_generated/models/organization.py +83 -0
- grepvine-0.1.0/src/grepvine/_generated/models/organization_page.py +69 -0
- grepvine-0.1.0/src/grepvine/_generated/models/pagination.py +54 -0
- grepvine-0.1.0/src/grepvine/_generated/models/put_document_form.py +97 -0
- grepvine-0.1.0/src/grepvine/_generated/models/put_document_if_none_match.py +8 -0
- grepvine-0.1.0/src/grepvine/_generated/models/put_object_record.py +97 -0
- grepvine-0.1.0/src/grepvine/_generated/models/query_page.py +69 -0
- grepvine-0.1.0/src/grepvine/_generated/models/query_request.py +122 -0
- grepvine-0.1.0/src/grepvine/_generated/models/query_request_mode.py +9 -0
- grepvine-0.1.0/src/grepvine/_generated/models/query_result.py +202 -0
- grepvine-0.1.0/src/grepvine/_generated/models/register_request.py +73 -0
- grepvine-0.1.0/src/grepvine/_generated/models/role.py +11 -0
- grepvine-0.1.0/src/grepvine/_generated/models/signup_mode.py +9 -0
- grepvine-0.1.0/src/grepvine/_generated/models/staff_role.py +9 -0
- grepvine-0.1.0/src/grepvine/_generated/models/tagged_boolean_metadata_value.py +56 -0
- grepvine-0.1.0/src/grepvine/_generated/models/tagged_integer_metadata_value.py +56 -0
- grepvine-0.1.0/src/grepvine/_generated/models/tagged_metadata.py +163 -0
- grepvine-0.1.0/src/grepvine/_generated/models/tagged_number_metadata_value.py +56 -0
- grepvine-0.1.0/src/grepvine/_generated/models/tagged_string_metadata_value.py +56 -0
- grepvine-0.1.0/src/grepvine/_generated/models/tagged_timestamp_metadata_value.py +58 -0
- grepvine-0.1.0/src/grepvine/_generated/models/transfer_ownership_request.py +45 -0
- grepvine-0.1.0/src/grepvine/_generated/models/update_index_request.py +68 -0
- grepvine-0.1.0/src/grepvine/_generated/models/update_member_request.py +46 -0
- grepvine-0.1.0/src/grepvine/_generated/models/update_member_request_role.py +10 -0
- grepvine-0.1.0/src/grepvine/_generated/models/user.py +92 -0
- grepvine-0.1.0/src/grepvine/_generated/models/username_availability.py +53 -0
- grepvine-0.1.0/src/grepvine/_generated/types.py +54 -0
- grepvine-0.1.0/src/grepvine/_helpers.py +332 -0
- grepvine-0.1.0/src/grepvine/_retry.py +135 -0
- grepvine-0.1.0/src/grepvine/errors.py +206 -0
- grepvine-0.1.0/src/grepvine/models.py +7 -0
- grepvine-0.1.0/src/grepvine/py.typed +0 -0
grepvine-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
grepvine-0.1.0/NOTICE
ADDED
grepvine-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: grepvine
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for the Grepvine search API
|
|
5
|
+
Project-URL: Homepage, https://grepvine.ai
|
|
6
|
+
Project-URL: Documentation, https://grepvine-ai.github.io/grepvine-python-sdk/
|
|
7
|
+
Project-URL: Source, https://github.com/grepvine-ai/grepvine-python-sdk
|
|
8
|
+
Project-URL: Issues, https://github.com/grepvine-ai/grepvine-python-sdk/issues
|
|
9
|
+
Author: Grepvine
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: grepvine,regex,sdk,search
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: attrs>=25
|
|
22
|
+
Requires-Dist: httpx<0.29,>=0.28
|
|
23
|
+
Requires-Dist: python-dateutil>=2.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# Grepvine Python SDK
|
|
27
|
+
|
|
28
|
+
The Python SDK for Grepvine, a search service for large collections of text:
|
|
29
|
+
regular-expression and literal search over every line of every document, with
|
|
30
|
+
metadata filters and paged results. It covers the whole Grepvine API:
|
|
31
|
+
organizations and their members, indexes, documents, search, API keys, user
|
|
32
|
+
accounts and device login.
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
pip install grepvine
|
|
38
|
+
# or
|
|
39
|
+
uv add grepvine
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Python 3.11 or later. The package is imported as `grepvine`, ships type
|
|
43
|
+
hints, and has both a synchronous and an asynchronous client.
|
|
44
|
+
|
|
45
|
+
## Authentication
|
|
46
|
+
|
|
47
|
+
Pass your API key, and the endpoint when you use a service other than
|
|
48
|
+
`https://api.grepvine.ai`:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import grepvine
|
|
52
|
+
|
|
53
|
+
client = grepvine.Client(api_key="gvk_...", endpoint="https://grepvine.example.com")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The SDK reads no environment variables or configuration files; pass the values
|
|
57
|
+
from wherever your application keeps them. An endpoint may be given with or
|
|
58
|
+
without `/v1`. A `Client` also takes `timeout` (seconds, or an
|
|
59
|
+
`httpx.Timeout`), `retry` (a `RetryPolicy`, see [Errors](#errors)) and
|
|
60
|
+
`transport` (an `httpx` transport, such as `httpx.MockTransport` in tests).
|
|
61
|
+
Use it as a context manager, or call `close()`, to release its connections.
|
|
62
|
+
To obtain a key without a browser session, see [Device login](#device-login).
|
|
63
|
+
|
|
64
|
+
The client's resources follow the API: `client.organizations` (with
|
|
65
|
+
`client.organizations.members`), `client.indexes`, `client.documents`,
|
|
66
|
+
`client.search`, `client.api_keys`, `client.account` and
|
|
67
|
+
`client.device_login`. Each method takes the operation's path parameters
|
|
68
|
+
(`organization`, `index`, `key`) positionally, and its query parameters and
|
|
69
|
+
request body (`body=`, a model from `grepvine.models`) by name. It returns
|
|
70
|
+
the API's response model, or `None` for an empty answer.
|
|
71
|
+
|
|
72
|
+
## Organizations
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from grepvine.models import (
|
|
76
|
+
AddMemberRequest,
|
|
77
|
+
AddMemberRequestRole,
|
|
78
|
+
CreateOrganizationRequest,
|
|
79
|
+
TransferOwnershipRequest,
|
|
80
|
+
UpdateMemberRequest,
|
|
81
|
+
UpdateMemberRequestRole,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
for org in grepvine.paginate(client.organizations.list):
|
|
85
|
+
print(org.name, org.role, org.suspended)
|
|
86
|
+
|
|
87
|
+
org = client.organizations.get("my-org")
|
|
88
|
+
client.organizations.create(body=CreateOrganizationRequest(name="my-org")) # you become its owner
|
|
89
|
+
|
|
90
|
+
members = client.organizations.members
|
|
91
|
+
members.add("my-org", body=AddMemberRequest(user="bob", role=AddMemberRequestRole.DEVELOPER))
|
|
92
|
+
members.update("my-org", "bob", body=UpdateMemberRequest(role=UpdateMemberRequestRole.ADMIN))
|
|
93
|
+
for member in grepvine.paginate(members.list, organization="my-org"):
|
|
94
|
+
print(member.user.name, member.role)
|
|
95
|
+
members.remove("my-org", "bob")
|
|
96
|
+
|
|
97
|
+
# The old owner becomes an admin.
|
|
98
|
+
client.organizations.transfer_ownership("my-org", body=TransferOwnershipRequest(user="carol"))
|
|
99
|
+
client.organizations.delete("my-org") # deletion completes in the background
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Organizations and user accounts share one namespace, so an organization name
|
|
103
|
+
must not be taken by a user either. Adding, changing and removing members
|
|
104
|
+
needs the admin or owner role; transferring ownership and deleting the
|
|
105
|
+
organization need the owner role.
|
|
106
|
+
|
|
107
|
+
A suspended organization keeps its data, but refuses every operation on its
|
|
108
|
+
members, indexes, documents and searches with `PermissionDeniedError` and code
|
|
109
|
+
`"organization_suspended"` until it is resumed. `organizations.get` and
|
|
110
|
+
`organizations.list` still answer, with `suspended` set. Contact support.
|
|
111
|
+
|
|
112
|
+
## Indexes
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from grepvine.models import CreateIndexRequest, IndexTagChanges, IndexTags, UpdateIndexRequest
|
|
116
|
+
|
|
117
|
+
client.indexes.create(
|
|
118
|
+
"my-org",
|
|
119
|
+
body=CreateIndexRequest(
|
|
120
|
+
name="my-index",
|
|
121
|
+
description="# Product docs\n\nEvery guide we publish.", # Markdown, optional
|
|
122
|
+
tags=IndexTags.from_dict({"team": "search", "commit": "3f9c2a1"}), # optional
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
index = client.indexes.wait_until_ready("my-org", "my-index", timeout=60)
|
|
126
|
+
print(index.state, index.document_count, index.tags["commit"])
|
|
127
|
+
|
|
128
|
+
for summary in grepvine.paginate(client.indexes.list, organization="my-org", prefix="docs-"):
|
|
129
|
+
print(f"{summary.name}: {summary.document_count} documents")
|
|
130
|
+
|
|
131
|
+
# Set one tag and remove another; tags left out stay as they are.
|
|
132
|
+
changes = IndexTagChanges.from_dict({"team": "platform", "commit": None})
|
|
133
|
+
client.indexes.update("my-org", "my-index", body=UpdateIndexRequest(tags=changes))
|
|
134
|
+
client.indexes.delete("my-org", "my-index") # deletion completes in the background
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
A new index is `creating` for a moment before it is `ready`.
|
|
138
|
+
`indexes.wait_until_ready(organization, index, timeout=..., interval=...)`
|
|
139
|
+
reads the index until it is ready and returns it. It raises `TimeoutError`
|
|
140
|
+
after `timeout` seconds (300 by default), and `GrepvineError` for an index
|
|
141
|
+
that is being deleted.
|
|
142
|
+
|
|
143
|
+
An index's `description` is Markdown, at most 16,384 characters, and empty
|
|
144
|
+
when none was set. `update` sends only the fields you set, so changing the
|
|
145
|
+
description leaves the tags alone and the other way round. Changing a
|
|
146
|
+
description or tags needs the admin or owner role.
|
|
147
|
+
|
|
148
|
+
## Search
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
from grepvine.models import QueryRequest, QueryRequestMode
|
|
152
|
+
|
|
153
|
+
query = QueryRequest(
|
|
154
|
+
pattern="hello world",
|
|
155
|
+
mode=QueryRequestMode.LITERAL, # the default is a regular expression
|
|
156
|
+
case_sensitive=False,
|
|
157
|
+
whole_word=True, # literal mode only
|
|
158
|
+
filter_="path STARTSWITH 'src/' AND size < 100000",
|
|
159
|
+
lines_before=2,
|
|
160
|
+
lines_after=2,
|
|
161
|
+
)
|
|
162
|
+
for result in grepvine.paginate(
|
|
163
|
+
client.search.query, organization="my-org", index="my-index", body=query
|
|
164
|
+
):
|
|
165
|
+
print(f"{result.key}:{result.line_number}: {result.text}")
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`client.search.query` returns one `QueryPage`; `grepvine.paginate` walks
|
|
169
|
+
every page. A result carries the covered `text`, its `line_number`, the
|
|
170
|
+
context lines, and the `matches` as byte offsets within the document.
|
|
171
|
+
|
|
172
|
+
Filters are expressions over document metadata, such as
|
|
173
|
+
`path STARTSWITH 'docs/' AND mtime >= (CURRENT_DATE - INTERVAL '3 days')`.
|
|
174
|
+
`documents.put_many` records `path` and `size` metadata on every document it
|
|
175
|
+
stores, so filters on those fields work without extra effort.
|
|
176
|
+
|
|
177
|
+
## Documents
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
results = client.documents.put_many(
|
|
181
|
+
"my-org",
|
|
182
|
+
"my-index",
|
|
183
|
+
[
|
|
184
|
+
{"key": "a.txt", "content": "alpha", "metadata": {"lang": "en"}},
|
|
185
|
+
{"key": "b.txt", "content": b"beta", "if_none_match": True},
|
|
186
|
+
{"key": "c.txt", "content": "gamma", "if_match": revision},
|
|
187
|
+
],
|
|
188
|
+
)
|
|
189
|
+
for result in results:
|
|
190
|
+
if result.error:
|
|
191
|
+
print(f"{result.key} was not stored: {result.error.error}")
|
|
192
|
+
|
|
193
|
+
for document in grepvine.paginate(
|
|
194
|
+
client.documents.list, organization="my-org", index="my-index", prefix="notes/"
|
|
195
|
+
):
|
|
196
|
+
print(document.key, document.content_bytes, document.searchable)
|
|
197
|
+
|
|
198
|
+
file = client.documents.get("my-org", "my-index", "a.txt")
|
|
199
|
+
print(file.payload.read())
|
|
200
|
+
|
|
201
|
+
client.documents.delete("my-org", "my-index", "a.txt")
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`put_many` stores text documents in as few requests as possible, at most
|
|
205
|
+
2,048 documents and 16 MiB of text per request, and returns one
|
|
206
|
+
`MutationResult` per document in input order. Content is a `str` or UTF-8
|
|
207
|
+
`bytes`. Metadata values may be `str`, `int`, `float`, `bool`, or `datetime`;
|
|
208
|
+
the SDK tags them for the API, and adds `path` (the key) and `size` fields,
|
|
209
|
+
which your own fields override. A document may carry up to 64 metadata
|
|
210
|
+
fields.
|
|
211
|
+
|
|
212
|
+
A document whose `if_match` or `if_none_match` condition fails is left
|
|
213
|
+
unchanged and the others are written; its result has no `revision`, and its
|
|
214
|
+
`error` has the `code` `"precondition_failed"`. If a request fails after
|
|
215
|
+
earlier requests were answered, `put_many` raises `PartialBatchError` with
|
|
216
|
+
`committed` (the results so far), `failed_keys` (the documents of the failed
|
|
217
|
+
request; the service may have written some of them) and `pending_keys` (the
|
|
218
|
+
documents never sent). If the first request fails, the SDK raises its error
|
|
219
|
+
unchanged. To finish an interrupted call safely, pass an `idempotency_key` of
|
|
220
|
+
at least 16 characters and repeat the call with the same key and the same
|
|
221
|
+
documents: no document is written twice.
|
|
222
|
+
|
|
223
|
+
For a binary document, or one larger than 16 MiB, use `documents.put` with a
|
|
224
|
+
`PutDocumentForm`; its `metadata` is a `Metadata`, such as
|
|
225
|
+
`Metadata.from_dict({"lang": "en", "score": {"type": "number", "value": 0.5}})`.
|
|
226
|
+
There strings, booleans and integers may be plain, while other numbers and
|
|
227
|
+
timestamps take the tagged `{"type", "value"}` form. Listings return every
|
|
228
|
+
value tagged, as a `TaggedStringMetadataValue`, `TaggedIntegerMetadataValue`,
|
|
229
|
+
`TaggedNumberMetadataValue`, `TaggedBooleanMetadataValue` or
|
|
230
|
+
`TaggedTimestampMetadataValue`. Documents can be up to 1 GiB; content that is valid UTF-8
|
|
231
|
+
and at most 100 MiB is searchable, and anything else is stored and served but
|
|
232
|
+
never matched by a search. `documents.put_batch` and `documents.delete_batch`
|
|
233
|
+
send one request each, and `documents.delete` removes one document; with
|
|
234
|
+
`if_match`, a failed condition on `put` or `delete` raises
|
|
235
|
+
`PreconditionFailedError`.
|
|
236
|
+
|
|
237
|
+
## Pagination
|
|
238
|
+
|
|
239
|
+
Every list method, and `search.query`, returns one page: its `results` and a
|
|
240
|
+
`pagination` with `next_page_id` and `has_next`. `grepvine.paginate` takes
|
|
241
|
+
the method and its arguments by name and yields every result, following
|
|
242
|
+
`next_page_id` while `has_next` is true:
|
|
243
|
+
|
|
244
|
+
```python
|
|
245
|
+
for index in grepvine.paginate(client.indexes.list, organization="acme"):
|
|
246
|
+
print(index.name)
|
|
247
|
+
|
|
248
|
+
page = client.indexes.list("acme", amount=100) # one page of up to 100
|
|
249
|
+
later = client.indexes.list("acme", amount=100, page=page.pagination.next_page_id)
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
A page may be empty while more results follow, especially in search;
|
|
253
|
+
`paginate` keeps going until the service reports the end. A `next_page_id` is
|
|
254
|
+
valid for 15 minutes and only with the same arguments, including `amount`;
|
|
255
|
+
otherwise the service answers with `InvalidPageError`. With `AsyncClient`,
|
|
256
|
+
iterate with `async for`.
|
|
257
|
+
|
|
258
|
+
## Errors
|
|
259
|
+
|
|
260
|
+
Every error is a `GrepvineError`. Errors from the service are `APIError`
|
|
261
|
+
subclasses with `status_code`, `code`, `reason`, `message`, `request_id` and,
|
|
262
|
+
when the service sent one, `retry_after`:
|
|
263
|
+
|
|
264
|
+
| Exception | When |
|
|
265
|
+
|---|---|
|
|
266
|
+
| `InvalidRequestError` | The request was rejected; fix the input. `InvalidPageError` for a bad page token. |
|
|
267
|
+
| `AuthenticationError` | The API key is missing or not valid. |
|
|
268
|
+
| `PermissionDeniedError` | The key may not perform the action. Code `"organization_suspended"` when the organization is suspended. |
|
|
269
|
+
| `NotFoundError` | The resource does not exist or is not visible. |
|
|
270
|
+
| `ConflictError` | The request conflicts with the current state, such as creating an index that exists. |
|
|
271
|
+
| `PreconditionFailedError` | An `if_match` or `if_none_match` condition failed on a single-document write. |
|
|
272
|
+
| `PayloadTooLargeError` | A document or batch is over its size limit. |
|
|
273
|
+
| `RangeNotSatisfiableError` | A byte range does not overlap the document. |
|
|
274
|
+
| `RateLimitedError` | The service kept asking the client to slow down for longer than the client was willing to wait. |
|
|
275
|
+
| `ServerError` | The service failed on every attempt. |
|
|
276
|
+
|
|
277
|
+
`ConfigurationError` means the endpoint is not an `http` or `https` URL.
|
|
278
|
+
`TransportError` means the request could not be delivered. `PartialBatchError`
|
|
279
|
+
is described under [Documents](#documents).
|
|
280
|
+
|
|
281
|
+
The SDK retries on its own. A `429` waits for the interval the service asks
|
|
282
|
+
for in `Retry-After` (with jitter, up to a minute at a time and ten minutes in
|
|
283
|
+
total per request). A `5xx` answer or a connection failure is retried twice
|
|
284
|
+
more with a short backoff. Every write carries an `Idempotency-Key` that
|
|
285
|
+
stays the same across retries, so a retried write is applied once. Pass
|
|
286
|
+
`retry=grepvine.RetryPolicy(...)` to change these bounds.
|
|
287
|
+
|
|
288
|
+
## Asynchronous use
|
|
289
|
+
|
|
290
|
+
`AsyncClient` takes the same arguments and has the same resources and
|
|
291
|
+
methods, awaited. Create it inside the event loop that will use it:
|
|
292
|
+
|
|
293
|
+
```python
|
|
294
|
+
import asyncio
|
|
295
|
+
|
|
296
|
+
import grepvine
|
|
297
|
+
from grepvine.models import QueryRequest
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
async def main() -> None:
|
|
301
|
+
async with grepvine.AsyncClient(api_key="gvk_...") as client:
|
|
302
|
+
await client.indexes.wait_until_ready("my-org", "my-index")
|
|
303
|
+
await client.documents.put_many("my-org", "my-index", [{"key": "a.txt", "content": "alpha"}])
|
|
304
|
+
query = QueryRequest(pattern="alpha")
|
|
305
|
+
async for result in grepvine.paginate(
|
|
306
|
+
client.search.query, organization="my-org", index="my-index", body=query
|
|
307
|
+
):
|
|
308
|
+
print(result.key, result.line_number)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
asyncio.run(main())
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## API keys
|
|
315
|
+
|
|
316
|
+
A signed-in user manages their API keys through `client.api_keys`:
|
|
317
|
+
|
|
318
|
+
```python
|
|
319
|
+
from grepvine.models import CreateAPIKeyRequest
|
|
320
|
+
|
|
321
|
+
key = client.api_keys.create(body=CreateAPIKeyRequest(name="ci")) # 1 to 128 characters
|
|
322
|
+
print(key.key) # the secret, shown only now
|
|
323
|
+
|
|
324
|
+
for listed in grepvine.paginate(client.api_keys.list):
|
|
325
|
+
print(listed.id, listed.name, listed.prefix, listed.last_used_at, listed.revoked_at)
|
|
326
|
+
|
|
327
|
+
client.api_keys.revoke(key.id)
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
A listing shows each key's `prefix`, never its secret. A revoked key stays in
|
|
331
|
+
the listing with its `revoked_at` time, and requests that use it fail with
|
|
332
|
+
`AuthenticationError`.
|
|
333
|
+
|
|
334
|
+
## Account
|
|
335
|
+
|
|
336
|
+
`client.account` registers users, signs them in and out, and changes their
|
|
337
|
+
password. The API key is the way to authenticate everything else; a session is
|
|
338
|
+
for scripts that start from a username and password, such as end-to-end tests
|
|
339
|
+
that create an account and its first API key. Create the client without an
|
|
340
|
+
API key for them:
|
|
341
|
+
|
|
342
|
+
```python
|
|
343
|
+
from grepvine.models import ChangePasswordRequest, LoginRequest, RegisterRequest
|
|
344
|
+
|
|
345
|
+
client = grepvine.Client(endpoint="https://grepvine.example.com")
|
|
346
|
+
|
|
347
|
+
if client.account.username_availability("alice").available:
|
|
348
|
+
client.account.register(
|
|
349
|
+
body=RegisterRequest(name="alice", email="alice@example.com", password="a long passphrase")
|
|
350
|
+
)
|
|
351
|
+
client.account.login(body=LoginRequest(identifier="alice", password="a long passphrase"))
|
|
352
|
+
|
|
353
|
+
print(client.account.me().email)
|
|
354
|
+
client.account.change_password(
|
|
355
|
+
body=ChangePasswordRequest(current_password="a long passphrase", new_password="a longer one!")
|
|
356
|
+
)
|
|
357
|
+
client.account.logout()
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
`login` starts a session on the client: later requests carry its cookie and
|
|
361
|
+
CSRF token. A taken username or email address raises `ConflictError` with
|
|
362
|
+
code `"username_taken"` or `"email_taken"`, and wrong credentials raise
|
|
363
|
+
`AuthenticationError`. Passwords are at least 12 characters.
|
|
364
|
+
|
|
365
|
+
`account.auth_options()` reports whether anyone may register (`signup` is
|
|
366
|
+
`"open"`) or only with an invitation (`"invite"`). Then pass the invitation
|
|
367
|
+
link's token as `RegisterRequest(..., invitation=token)`; without one,
|
|
368
|
+
`register` raises `PermissionDeniedError` with code `"invitation_required"`,
|
|
369
|
+
and with one that was used, withdrawn or has expired, code
|
|
370
|
+
`"invitation_invalid"`. `account.check_invitation(body=InvitationCheckRequest(token=token))`
|
|
371
|
+
shows what a pending invitation offers before registering.
|
|
372
|
+
|
|
373
|
+
## Device login
|
|
374
|
+
|
|
375
|
+
Device login gives an API key to a program, such as a command-line tool or an
|
|
376
|
+
agent, once a person approves it in a signed-in browser. `authorize` does the
|
|
377
|
+
program's part in one call: it starts the login, hands the code to `on_code`
|
|
378
|
+
to show, and waits for the person's decision, polling at the interval the
|
|
379
|
+
service asks for and slowing down when asked to.
|
|
380
|
+
|
|
381
|
+
```python
|
|
382
|
+
from grepvine.models import DeviceAuthorization
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
def show(authorization: DeviceAuthorization) -> None:
|
|
386
|
+
print(f"Open {authorization.verification_uri_complete}")
|
|
387
|
+
print(f"and check that it shows {authorization.user_code}")
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
with grepvine.Client() as anonymous: # starting a device login needs no API key
|
|
391
|
+
key = anonymous.device_login.authorize("my laptop", on_code=show, timeout=600)
|
|
392
|
+
client = grepvine.Client(api_key=key.key)
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
A denied login raises `InvalidRequestError` with code `"access_denied"`, and
|
|
396
|
+
an expired one with `"expired_token"`. A login that is not approved within
|
|
397
|
+
`timeout` seconds, or before it expires, raises `TimeoutError`.
|
|
398
|
+
|
|
399
|
+
The steps are also available one at a time: the program calls
|
|
400
|
+
`device_login.start` and `device_login.poll`, and the person, or a tool
|
|
401
|
+
acting for them, calls `device_login.approve` or `device_login.deny` with the
|
|
402
|
+
user code. `poll` raises `InvalidRequestError` with code
|
|
403
|
+
`"authorization_pending"` while the person has not decided, and `"slow_down"`
|
|
404
|
+
when polled more often than the authorization's `interval`.
|
|
405
|
+
|
|
406
|
+
## Other requests
|
|
407
|
+
|
|
408
|
+
`client.http` is the `httpx.Client` (an `httpx.AsyncClient` for
|
|
409
|
+
`AsyncClient`) the client sends its requests with: it has the endpoint,
|
|
410
|
+
credentials, timeout and retries, and raises the SDK's errors. Use it for
|
|
411
|
+
anything the methods above do not cover, such as streaming a large document
|
|
412
|
+
to a file:
|
|
413
|
+
|
|
414
|
+
```python
|
|
415
|
+
from urllib.parse import quote
|
|
416
|
+
|
|
417
|
+
path = f"/organizations/my-org/indexes/my-index/objects/{quote('videos/demo.mp4', safe='')}"
|
|
418
|
+
with client.http.stream("GET", path) as response, open("demo.mp4", "wb") as file:
|
|
419
|
+
for chunk in response.iter_bytes():
|
|
420
|
+
file.write(chunk)
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Paths are relative to the endpoint's `/v1`.
|
|
424
|
+
|
|
425
|
+
## Thread safety
|
|
426
|
+
|
|
427
|
+
A `Client` may be shared between threads. An iterator from `paginate` is not
|
|
428
|
+
thread-safe.
|
|
429
|
+
|
|
430
|
+
## Limits worth knowing
|
|
431
|
+
|
|
432
|
+
- One document: at most 1 GiB, and a single upload must finish within the
|
|
433
|
+
service's request deadline of 35 seconds.
|
|
434
|
+
- One batch: at most 2,048 documents and 16 MiB of text.
|
|
435
|
+
- Keys: 1 to 1,024 characters. Organization and index names: letters, digits,
|
|
436
|
+
and hyphens, starting with a letter. A name keeps the case it was created
|
|
437
|
+
with, and any spelling that differs only in case refers to the same
|
|
438
|
+
organization or index.
|
|
439
|
+
- `lines_before` and `lines_after`: at most 20 each.
|
|
440
|
+
- Tags: at most 64 per index. A key is 1 to 128 characters without whitespace
|
|
441
|
+
or control characters; a value is at most 1,024 characters without control
|
|
442
|
+
characters.
|
|
443
|
+
|
|
444
|
+
## Examples
|
|
445
|
+
|
|
446
|
+
The `examples` directory holds complete programs. They read the API key from
|
|
447
|
+
`GREPVINE_API_KEY` and, for a service other than the default, the endpoint from
|
|
448
|
+
`GREPVINE_API_ENDPOINT`, and pass them to the client:
|
|
449
|
+
|
|
450
|
+
```sh
|
|
451
|
+
export GREPVINE_ORGANIZATION=my-org
|
|
452
|
+
python examples/ingest_search.py # add --keep-index to keep the documents
|
|
453
|
+
python examples/ingest_search_async.py
|
|
454
|
+
python examples/device_login.py
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
The ingest example creates a uniquely named index, stores three documents,
|
|
458
|
+
searches them with and without a metadata filter, and deletes the index at
|
|
459
|
+
the end. The organization must exist, and the key needs permission to create
|
|
460
|
+
and delete indexes.
|
|
461
|
+
|
|
462
|
+
## License
|
|
463
|
+
|
|
464
|
+
Licensed under the Apache License 2.0. See `LICENSE` and `NOTICE`.
|