payi 0.1.0a18__py3-none-any.whl → 0.1.0a20__py3-none-any.whl
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.
Potentially problematic release.
This version of payi might be problematic. Click here for more details.
- payi/_client.py +24 -24
- payi/_version.py +1 -1
- payi/lib/helpers.py +7 -1
- payi/resources/budgets/budgets.py +2 -2
- payi/resources/budgets/tags.py +10 -10
- payi/resources/experiences/experiences.py +16 -24
- payi/resources/ingest.py +12 -12
- payi/types/experience_instance.py +1 -1
- payi/types/ingest_event_param.py +1 -1
- payi/types/ingest_units_params.py +1 -1
- {payi-0.1.0a18.dist-info → payi-0.1.0a20.dist-info}/METADATA +6 -6
- {payi-0.1.0a18.dist-info → payi-0.1.0a20.dist-info}/RECORD +14 -14
- {payi-0.1.0a18.dist-info → payi-0.1.0a20.dist-info}/WHEEL +0 -0
- {payi-0.1.0a18.dist-info → payi-0.1.0a20.dist-info}/licenses/LICENSE +0 -0
payi/_client.py
CHANGED
|
@@ -54,12 +54,12 @@ class Payi(SyncAPIClient):
|
|
|
54
54
|
with_streaming_response: PayiWithStreamedResponse
|
|
55
55
|
|
|
56
56
|
# client options
|
|
57
|
-
|
|
57
|
+
api_key: str
|
|
58
58
|
|
|
59
59
|
def __init__(
|
|
60
60
|
self,
|
|
61
61
|
*,
|
|
62
|
-
|
|
62
|
+
api_key: str | None = None,
|
|
63
63
|
base_url: str | httpx.URL | None = None,
|
|
64
64
|
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
|
|
65
65
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
@@ -81,15 +81,15 @@ class Payi(SyncAPIClient):
|
|
|
81
81
|
) -> None:
|
|
82
82
|
"""Construct a new synchronous payi client instance.
|
|
83
83
|
|
|
84
|
-
This automatically infers the `
|
|
84
|
+
This automatically infers the `api_key` argument from the `PAYI_API_KEY` environment variable if it is not provided.
|
|
85
85
|
"""
|
|
86
|
-
if
|
|
87
|
-
|
|
88
|
-
if
|
|
86
|
+
if api_key is None:
|
|
87
|
+
api_key = os.environ.get("PAYI_API_KEY")
|
|
88
|
+
if api_key is None:
|
|
89
89
|
raise PayiError(
|
|
90
|
-
"The
|
|
90
|
+
"The api_key client option must be set either by passing api_key to the client or by setting the PAYI_API_KEY environment variable"
|
|
91
91
|
)
|
|
92
|
-
self.
|
|
92
|
+
self.api_key = api_key
|
|
93
93
|
|
|
94
94
|
if base_url is None:
|
|
95
95
|
base_url = os.environ.get("PAYI_BASE_URL")
|
|
@@ -122,8 +122,8 @@ class Payi(SyncAPIClient):
|
|
|
122
122
|
@property
|
|
123
123
|
@override
|
|
124
124
|
def auth_headers(self) -> dict[str, str]:
|
|
125
|
-
|
|
126
|
-
return {"Authorization":
|
|
125
|
+
api_key = self.api_key
|
|
126
|
+
return {"Authorization": api_key}
|
|
127
127
|
|
|
128
128
|
@property
|
|
129
129
|
@override
|
|
@@ -137,7 +137,7 @@ class Payi(SyncAPIClient):
|
|
|
137
137
|
def copy(
|
|
138
138
|
self,
|
|
139
139
|
*,
|
|
140
|
-
|
|
140
|
+
api_key: str | None = None,
|
|
141
141
|
base_url: str | httpx.URL | None = None,
|
|
142
142
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
143
143
|
http_client: httpx.Client | None = None,
|
|
@@ -171,7 +171,7 @@ class Payi(SyncAPIClient):
|
|
|
171
171
|
|
|
172
172
|
http_client = http_client or self._client
|
|
173
173
|
return self.__class__(
|
|
174
|
-
|
|
174
|
+
api_key=api_key or self.api_key,
|
|
175
175
|
base_url=base_url or self.base_url,
|
|
176
176
|
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
|
177
177
|
http_client=http_client,
|
|
@@ -228,12 +228,12 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
228
228
|
with_streaming_response: AsyncPayiWithStreamedResponse
|
|
229
229
|
|
|
230
230
|
# client options
|
|
231
|
-
|
|
231
|
+
api_key: str
|
|
232
232
|
|
|
233
233
|
def __init__(
|
|
234
234
|
self,
|
|
235
235
|
*,
|
|
236
|
-
|
|
236
|
+
api_key: str | None = None,
|
|
237
237
|
base_url: str | httpx.URL | None = None,
|
|
238
238
|
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
|
|
239
239
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
@@ -255,15 +255,15 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
255
255
|
) -> None:
|
|
256
256
|
"""Construct a new async payi client instance.
|
|
257
257
|
|
|
258
|
-
This automatically infers the `
|
|
258
|
+
This automatically infers the `api_key` argument from the `PAYI_API_KEY` environment variable if it is not provided.
|
|
259
259
|
"""
|
|
260
|
-
if
|
|
261
|
-
|
|
262
|
-
if
|
|
260
|
+
if api_key is None:
|
|
261
|
+
api_key = os.environ.get("PAYI_API_KEY")
|
|
262
|
+
if api_key is None:
|
|
263
263
|
raise PayiError(
|
|
264
|
-
"The
|
|
264
|
+
"The api_key client option must be set either by passing api_key to the client or by setting the PAYI_API_KEY environment variable"
|
|
265
265
|
)
|
|
266
|
-
self.
|
|
266
|
+
self.api_key = api_key
|
|
267
267
|
|
|
268
268
|
if base_url is None:
|
|
269
269
|
base_url = os.environ.get("PAYI_BASE_URL")
|
|
@@ -296,8 +296,8 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
296
296
|
@property
|
|
297
297
|
@override
|
|
298
298
|
def auth_headers(self) -> dict[str, str]:
|
|
299
|
-
|
|
300
|
-
return {"Authorization":
|
|
299
|
+
api_key = self.api_key
|
|
300
|
+
return {"Authorization": api_key}
|
|
301
301
|
|
|
302
302
|
@property
|
|
303
303
|
@override
|
|
@@ -311,7 +311,7 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
311
311
|
def copy(
|
|
312
312
|
self,
|
|
313
313
|
*,
|
|
314
|
-
|
|
314
|
+
api_key: str | None = None,
|
|
315
315
|
base_url: str | httpx.URL | None = None,
|
|
316
316
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
317
317
|
http_client: httpx.AsyncClient | None = None,
|
|
@@ -345,7 +345,7 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
345
345
|
|
|
346
346
|
http_client = http_client or self._client
|
|
347
347
|
return self.__class__(
|
|
348
|
-
|
|
348
|
+
api_key=api_key or self.api_key,
|
|
349
349
|
base_url=base_url or self.base_url,
|
|
350
350
|
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
|
351
351
|
http_client=http_client,
|
payi/_version.py
CHANGED
payi/lib/helpers.py
CHANGED
|
@@ -20,7 +20,9 @@ def create_request_header_from_tags(request_tags: List[str]) -> Dict[str, str]:
|
|
|
20
20
|
|
|
21
21
|
def create_headers(
|
|
22
22
|
budget_ids: Union[List[str], None] = None,
|
|
23
|
-
request_tags: Union[List[str], None] = None
|
|
23
|
+
request_tags: Union[List[str], None] = None,
|
|
24
|
+
user_id: Union[str, None] = None,
|
|
25
|
+
experience_id: Union[str, None] = None,
|
|
24
26
|
) -> Dict[str, str]:
|
|
25
27
|
headers: Dict[str, str] = {}
|
|
26
28
|
|
|
@@ -28,5 +30,9 @@ def create_headers(
|
|
|
28
30
|
headers.update(create_budget_header_from_ids(budget_ids))
|
|
29
31
|
if request_tags:
|
|
30
32
|
headers.update(create_request_header_from_tags(request_tags))
|
|
33
|
+
if user_id:
|
|
34
|
+
headers.update({"xProxy-User-ID": user_id})
|
|
35
|
+
if experience_id:
|
|
36
|
+
headers.update({"xProxy-Experience-Id": experience_id})
|
|
31
37
|
|
|
32
38
|
return headers
|
|
@@ -119,7 +119,7 @@ class BudgetsResource(SyncAPIResource):
|
|
|
119
119
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
120
120
|
) -> BudgetResponse:
|
|
121
121
|
"""
|
|
122
|
-
Get
|
|
122
|
+
Get Budget details
|
|
123
123
|
|
|
124
124
|
Args:
|
|
125
125
|
budget_id (str): The ID of the budget.
|
|
@@ -368,7 +368,7 @@ class AsyncBudgetsResource(AsyncAPIResource):
|
|
|
368
368
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
369
369
|
) -> BudgetResponse:
|
|
370
370
|
"""
|
|
371
|
-
Get
|
|
371
|
+
Get Budget details
|
|
372
372
|
|
|
373
373
|
Args:
|
|
374
374
|
extra_headers: Send extra headers
|
payi/resources/budgets/tags.py
CHANGED
|
@@ -52,7 +52,7 @@ class TagsResource(SyncAPIResource):
|
|
|
52
52
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
53
53
|
) -> TagCreateResponse:
|
|
54
54
|
"""
|
|
55
|
-
Add Tags
|
|
55
|
+
Add Budget Tags
|
|
56
56
|
|
|
57
57
|
Args:
|
|
58
58
|
extra_headers: Send extra headers
|
|
@@ -87,7 +87,7 @@ class TagsResource(SyncAPIResource):
|
|
|
87
87
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
88
88
|
) -> TagUpdateResponse:
|
|
89
89
|
"""
|
|
90
|
-
Update the Budget
|
|
90
|
+
Update the Budget Tags
|
|
91
91
|
|
|
92
92
|
Args:
|
|
93
93
|
extra_headers: Send extra headers
|
|
@@ -121,7 +121,7 @@ class TagsResource(SyncAPIResource):
|
|
|
121
121
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
122
122
|
) -> TagListResponse:
|
|
123
123
|
"""
|
|
124
|
-
Get
|
|
124
|
+
Get Budget Tags
|
|
125
125
|
|
|
126
126
|
Args:
|
|
127
127
|
extra_headers: Send extra headers
|
|
@@ -154,7 +154,7 @@ class TagsResource(SyncAPIResource):
|
|
|
154
154
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
155
155
|
) -> TagDeleteResponse:
|
|
156
156
|
"""
|
|
157
|
-
Delete
|
|
157
|
+
Delete all Tags from Budget
|
|
158
158
|
|
|
159
159
|
Args:
|
|
160
160
|
extra_headers: Send extra headers
|
|
@@ -188,7 +188,7 @@ class TagsResource(SyncAPIResource):
|
|
|
188
188
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
189
189
|
) -> TagRemoveResponse:
|
|
190
190
|
"""
|
|
191
|
-
Remove Tags from
|
|
191
|
+
Remove Tags from Budget
|
|
192
192
|
|
|
193
193
|
Args:
|
|
194
194
|
extra_headers: Send extra headers
|
|
@@ -233,7 +233,7 @@ class AsyncTagsResource(AsyncAPIResource):
|
|
|
233
233
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
234
234
|
) -> TagCreateResponse:
|
|
235
235
|
"""
|
|
236
|
-
Add Tags
|
|
236
|
+
Add Budget Tags
|
|
237
237
|
|
|
238
238
|
Args:
|
|
239
239
|
extra_headers: Send extra headers
|
|
@@ -268,7 +268,7 @@ class AsyncTagsResource(AsyncAPIResource):
|
|
|
268
268
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
269
269
|
) -> TagUpdateResponse:
|
|
270
270
|
"""
|
|
271
|
-
Update the Budget
|
|
271
|
+
Update the Budget Tags
|
|
272
272
|
|
|
273
273
|
Args:
|
|
274
274
|
extra_headers: Send extra headers
|
|
@@ -302,7 +302,7 @@ class AsyncTagsResource(AsyncAPIResource):
|
|
|
302
302
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
303
303
|
) -> TagListResponse:
|
|
304
304
|
"""
|
|
305
|
-
Get
|
|
305
|
+
Get Budget Tags
|
|
306
306
|
|
|
307
307
|
Args:
|
|
308
308
|
extra_headers: Send extra headers
|
|
@@ -335,7 +335,7 @@ class AsyncTagsResource(AsyncAPIResource):
|
|
|
335
335
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
336
336
|
) -> TagDeleteResponse:
|
|
337
337
|
"""
|
|
338
|
-
Delete
|
|
338
|
+
Delete all Tags from Budget
|
|
339
339
|
|
|
340
340
|
Args:
|
|
341
341
|
extra_headers: Send extra headers
|
|
@@ -369,7 +369,7 @@ class AsyncTagsResource(AsyncAPIResource):
|
|
|
369
369
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
370
370
|
) -> TagRemoveResponse:
|
|
371
371
|
"""
|
|
372
|
-
Remove Tags from
|
|
372
|
+
Remove Tags from Budget
|
|
373
373
|
|
|
374
374
|
Args:
|
|
375
375
|
extra_headers: Send extra headers
|
|
@@ -77,7 +77,7 @@ class ExperiencesResource(SyncAPIResource):
|
|
|
77
77
|
|
|
78
78
|
def retrieve(
|
|
79
79
|
self,
|
|
80
|
-
|
|
80
|
+
experience_id: str,
|
|
81
81
|
*,
|
|
82
82
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
83
83
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -98,12 +98,10 @@ class ExperiencesResource(SyncAPIResource):
|
|
|
98
98
|
|
|
99
99
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
100
100
|
"""
|
|
101
|
-
if not
|
|
102
|
-
raise ValueError(
|
|
103
|
-
f"Expected a non-empty value for `experience_instance_id` but received {experience_instance_id!r}"
|
|
104
|
-
)
|
|
101
|
+
if not experience_id:
|
|
102
|
+
raise ValueError(f"Expected a non-empty value for `experience_id` but received {experience_id!r}")
|
|
105
103
|
return self._get(
|
|
106
|
-
f"/api/v1/experiences/instances/{
|
|
104
|
+
f"/api/v1/experiences/instances/{experience_id}",
|
|
107
105
|
options=make_request_options(
|
|
108
106
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
109
107
|
),
|
|
@@ -112,7 +110,7 @@ class ExperiencesResource(SyncAPIResource):
|
|
|
112
110
|
|
|
113
111
|
def delete(
|
|
114
112
|
self,
|
|
115
|
-
|
|
113
|
+
experience_id: str,
|
|
116
114
|
*,
|
|
117
115
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
118
116
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -135,12 +133,10 @@ class ExperiencesResource(SyncAPIResource):
|
|
|
135
133
|
|
|
136
134
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
137
135
|
"""
|
|
138
|
-
if not
|
|
139
|
-
raise ValueError(
|
|
140
|
-
f"Expected a non-empty value for `experience_instance_id` but received {experience_instance_id!r}"
|
|
141
|
-
)
|
|
136
|
+
if not experience_id:
|
|
137
|
+
raise ValueError(f"Expected a non-empty value for `experience_id` but received {experience_id!r}")
|
|
142
138
|
return self._delete(
|
|
143
|
-
f"/api/v1/experiences/instances/{
|
|
139
|
+
f"/api/v1/experiences/instances/{experience_id}",
|
|
144
140
|
options=make_request_options(
|
|
145
141
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
146
142
|
),
|
|
@@ -198,7 +194,7 @@ class AsyncExperiencesResource(AsyncAPIResource):
|
|
|
198
194
|
|
|
199
195
|
async def retrieve(
|
|
200
196
|
self,
|
|
201
|
-
|
|
197
|
+
experience_id: str,
|
|
202
198
|
*,
|
|
203
199
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
204
200
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -219,12 +215,10 @@ class AsyncExperiencesResource(AsyncAPIResource):
|
|
|
219
215
|
|
|
220
216
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
221
217
|
"""
|
|
222
|
-
if not
|
|
223
|
-
raise ValueError(
|
|
224
|
-
f"Expected a non-empty value for `experience_instance_id` but received {experience_instance_id!r}"
|
|
225
|
-
)
|
|
218
|
+
if not experience_id:
|
|
219
|
+
raise ValueError(f"Expected a non-empty value for `experience_id` but received {experience_id!r}")
|
|
226
220
|
return await self._get(
|
|
227
|
-
f"/api/v1/experiences/instances/{
|
|
221
|
+
f"/api/v1/experiences/instances/{experience_id}",
|
|
228
222
|
options=make_request_options(
|
|
229
223
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
230
224
|
),
|
|
@@ -233,7 +227,7 @@ class AsyncExperiencesResource(AsyncAPIResource):
|
|
|
233
227
|
|
|
234
228
|
async def delete(
|
|
235
229
|
self,
|
|
236
|
-
|
|
230
|
+
experience_id: str,
|
|
237
231
|
*,
|
|
238
232
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
239
233
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -256,12 +250,10 @@ class AsyncExperiencesResource(AsyncAPIResource):
|
|
|
256
250
|
|
|
257
251
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
258
252
|
"""
|
|
259
|
-
if not
|
|
260
|
-
raise ValueError(
|
|
261
|
-
f"Expected a non-empty value for `experience_instance_id` but received {experience_instance_id!r}"
|
|
262
|
-
)
|
|
253
|
+
if not experience_id:
|
|
254
|
+
raise ValueError(f"Expected a non-empty value for `experience_id` but received {experience_id!r}")
|
|
263
255
|
return await self._delete(
|
|
264
|
-
f"/api/v1/experiences/instances/{
|
|
256
|
+
f"/api/v1/experiences/instances/{experience_id}",
|
|
265
257
|
options=make_request_options(
|
|
266
258
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
267
259
|
),
|
payi/resources/ingest.py
CHANGED
|
@@ -84,7 +84,7 @@ class IngestResource(SyncAPIResource):
|
|
|
84
84
|
event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
85
85
|
budget_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
86
86
|
request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
87
|
-
|
|
87
|
+
experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
88
88
|
user_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
89
89
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
90
90
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -94,7 +94,7 @@ class IngestResource(SyncAPIResource):
|
|
|
94
94
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
95
95
|
) -> IngestResponse:
|
|
96
96
|
"""
|
|
97
|
-
Ingest
|
|
97
|
+
Ingest an Event
|
|
98
98
|
|
|
99
99
|
Args:
|
|
100
100
|
category (str): The name of the category
|
|
@@ -111,7 +111,7 @@ class IngestResource(SyncAPIResource):
|
|
|
111
111
|
|
|
112
112
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
experience_id (str, optional): The experience instance id
|
|
115
115
|
|
|
116
116
|
user_id (str, optional): The user id
|
|
117
117
|
|
|
@@ -144,8 +144,8 @@ class IngestResource(SyncAPIResource):
|
|
|
144
144
|
valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
|
|
145
145
|
valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
|
|
146
146
|
|
|
147
|
-
if
|
|
148
|
-
|
|
147
|
+
if experience_id is None or isinstance(experience_id, NotGiven):
|
|
148
|
+
experience_id = NOT_GIVEN
|
|
149
149
|
|
|
150
150
|
if user_id is None or isinstance(user_id, NotGiven):
|
|
151
151
|
user_id = NOT_GIVEN
|
|
@@ -155,7 +155,7 @@ class IngestResource(SyncAPIResource):
|
|
|
155
155
|
{
|
|
156
156
|
"xProxy-Budget-IDs": valid_ids_str,
|
|
157
157
|
"xProxy-Request-Tags": valid_tags_str,
|
|
158
|
-
"xProxy-Experience-
|
|
158
|
+
"xProxy-Experience-Id": experience_id,
|
|
159
159
|
"xProxy-User-ID": user_id,
|
|
160
160
|
}
|
|
161
161
|
),
|
|
@@ -233,7 +233,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
233
233
|
event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
234
234
|
budget_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
235
235
|
request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
236
|
-
|
|
236
|
+
experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
237
237
|
user_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
238
238
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
239
239
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -243,7 +243,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
243
243
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
244
244
|
) -> IngestResponse:
|
|
245
245
|
"""
|
|
246
|
-
Ingest
|
|
246
|
+
Ingest an Event
|
|
247
247
|
|
|
248
248
|
Args:
|
|
249
249
|
category (str): The name of the category
|
|
@@ -260,7 +260,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
260
260
|
|
|
261
261
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
262
262
|
|
|
263
|
-
|
|
263
|
+
experience_id (str, optional): The experience instance id
|
|
264
264
|
|
|
265
265
|
user_id (str, optional): The user id
|
|
266
266
|
|
|
@@ -293,8 +293,8 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
293
293
|
valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
|
|
294
294
|
valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
|
|
295
295
|
|
|
296
|
-
if
|
|
297
|
-
|
|
296
|
+
if experience_id is None or isinstance(experience_id, NotGiven):
|
|
297
|
+
experience_id = NOT_GIVEN
|
|
298
298
|
|
|
299
299
|
if user_id is None or isinstance(user_id, NotGiven):
|
|
300
300
|
user_id = NOT_GIVEN
|
|
@@ -304,7 +304,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
304
304
|
{
|
|
305
305
|
"xProxy-Budget-IDs": valid_ids_str,
|
|
306
306
|
"xProxy-Request-Tags": valid_tags_str,
|
|
307
|
-
"xProxy-Experience-
|
|
307
|
+
"xProxy-Experience-Id": experience_id,
|
|
308
308
|
"xProxy-User-ID": user_id,
|
|
309
309
|
}
|
|
310
310
|
),
|
payi/types/ingest_event_param.py
CHANGED
|
@@ -26,6 +26,6 @@ class IngestUnitsParams(TypedDict, total=False):
|
|
|
26
26
|
|
|
27
27
|
request_tags: Annotated[Union[list[str], None], PropertyInfo(alias="xProxy-Request-Tags")]
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
experience_id: Annotated[Union[str, None], PropertyInfo(alias="xProxy-Experience-Id")]
|
|
30
30
|
|
|
31
31
|
user_id: Annotated[Union[str, None], PropertyInfo(alias="xProxy-User-ID")]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: payi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a20
|
|
4
4
|
Summary: The official Python library for the payi API
|
|
5
5
|
Project-URL: Homepage, https://github.com/Pay-i/pay-i-python
|
|
6
6
|
Project-URL: Repository, https://github.com/Pay-i/pay-i-python
|
|
@@ -63,7 +63,7 @@ from payi import Payi
|
|
|
63
63
|
|
|
64
64
|
client = Payi(
|
|
65
65
|
# This is the default and can be omitted
|
|
66
|
-
|
|
66
|
+
api_key=os.environ.get("PAYI_API_KEY"),
|
|
67
67
|
)
|
|
68
68
|
|
|
69
69
|
budget_response = client.budgets.create(
|
|
@@ -73,10 +73,10 @@ budget_response = client.budgets.create(
|
|
|
73
73
|
print(budget_response.request_id)
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
While you can provide
|
|
76
|
+
While you can provide an `api_key` keyword argument,
|
|
77
77
|
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
|
|
78
|
-
to add `PAYI_API_KEY="My
|
|
79
|
-
so that your
|
|
78
|
+
to add `PAYI_API_KEY="My API Key"` to your `.env` file
|
|
79
|
+
so that your API Key is not stored in source control.
|
|
80
80
|
|
|
81
81
|
## Async usage
|
|
82
82
|
|
|
@@ -89,7 +89,7 @@ from payi import AsyncPayi
|
|
|
89
89
|
|
|
90
90
|
client = AsyncPayi(
|
|
91
91
|
# This is the default and can be omitted
|
|
92
|
-
|
|
92
|
+
api_key=os.environ.get("PAYI_API_KEY"),
|
|
93
93
|
)
|
|
94
94
|
|
|
95
95
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
payi/__init__.py,sha256=LWpfR6WSMPTnmmx3ToqqZ0A8CNduLcuxY1SSOqhPxuk,2381
|
|
2
2
|
payi/_base_client.py,sha256=ceMQR7sfWlJfFsA91UJzG4MT-QnPJ3jhqe-EpEmpRBo,66460
|
|
3
|
-
payi/_client.py,sha256=
|
|
3
|
+
payi/_client.py,sha256=RxYPuTG7ZWoSmp_FrUVcWyC_64nov_7_OvrwEM_8NN0,16672
|
|
4
4
|
payi/_compat.py,sha256=FgGcnNlyW7uHKyGh_Wvo7qZi-zVPmHx7mhb3F1GEZSw,6430
|
|
5
5
|
payi/_constants.py,sha256=JE8kyZa2Q4NK_i4fO--8siEYTzeHnT0fYbOFDgDP4uk,464
|
|
6
6
|
payi/_exceptions.py,sha256=ItygKNrNXIVY0H6LsGVZvFuAHB3Vtm_VZXmWzCnpHy0,3216
|
|
@@ -11,7 +11,7 @@ payi/_resource.py,sha256=j2jIkTr8OIC8sU6-05nxSaCyj4MaFlbZrwlyg4_xJos,1088
|
|
|
11
11
|
payi/_response.py,sha256=SByCajzglbiy7lSG4F5enqb7R6jVQe1OQ9TBsaxWzE8,28508
|
|
12
12
|
payi/_streaming.py,sha256=Z_wIyo206T6Jqh2rolFg2VXZgX24PahLmpURp0-NssU,10092
|
|
13
13
|
payi/_types.py,sha256=mb6zn5qmTK5j0QMh0fevdShT091HBL4w0YCUfQ3u5VY,6101
|
|
14
|
-
payi/_version.py,sha256=
|
|
14
|
+
payi/_version.py,sha256=3W3BUzu7bb2808mP87J3LsQod_Kdk48Xg2xQEHwc0ks,165
|
|
15
15
|
payi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
payi/_utils/__init__.py,sha256=Uzq1-FIih_VUjzdNVWXks0sdC39KBKLMrZoz-_JOjJ4,1988
|
|
17
17
|
payi/_utils/_logs.py,sha256=fmnf5D9TOgkgZKfgYmSa3PiUc3SZgkchn6CzJUeo0SQ,768
|
|
@@ -23,17 +23,17 @@ payi/_utils/_transform.py,sha256=NCz3q9_O-vuj60xVe-qzhEQ8uJWlZWJTsM-GwHDccf8,129
|
|
|
23
23
|
payi/_utils/_typing.py,sha256=tFbktdpdHCQliwzGsWysgn0P5H0JRdagkZdb_LegGkY,3838
|
|
24
24
|
payi/_utils/_utils.py,sha256=LMVTMZG8pfu8AkJNSfmv_z3guQlOfm2UxDTjTTXggfg,11411
|
|
25
25
|
payi/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
26
|
-
payi/lib/helpers.py,sha256=
|
|
26
|
+
payi/lib/helpers.py,sha256=JpI9vy--oJP5kUlcWK0yfyRUbIRMXkvLeUQC4g8rLNY,1472
|
|
27
27
|
payi/resources/__init__.py,sha256=0bsV7zh4J03yh3W3MBoiiIT12uG2tdvsDrdqOeY0Cbc,2032
|
|
28
|
-
payi/resources/ingest.py,sha256=
|
|
28
|
+
payi/resources/ingest.py,sha256=FTFU3eI6aUqekVMS3hig7pNn0kJCmZHI_h3lQVaVWKQ,14316
|
|
29
29
|
payi/resources/budgets/__init__.py,sha256=w1UhOdDXtUH4A91ME5Tw2nr9bRvPJyJY1YWiVVy7jj0,989
|
|
30
|
-
payi/resources/budgets/budgets.py,sha256=
|
|
31
|
-
payi/resources/budgets/tags.py,sha256=
|
|
30
|
+
payi/resources/budgets/budgets.py,sha256=5i-V9KT9SUmg3RbF0ZehEpCScMzAeszz9zia2jSzWcM,26500
|
|
31
|
+
payi/resources/budgets/tags.py,sha256=g0cln7tO1L1rm-hSZNnDJHdetiacDqExlSQ6YFudFsw,17817
|
|
32
32
|
payi/resources/categories/__init__.py,sha256=w5gMiPdBSzJA_qfoVtFBElaoe8wGf_O63R7R1Spr6Gk,1093
|
|
33
33
|
payi/resources/categories/categories.py,sha256=hqJE4iSiMe5nvvsui4RjFJxFb8170iRbJfTafk2NzGw,15072
|
|
34
34
|
payi/resources/categories/resources.py,sha256=qkKv8n_7nGOVuEI3Lcy5OfDK9Sb2pYZx3vBK7Ao9Ztw,17700
|
|
35
35
|
payi/resources/experiences/__init__.py,sha256=gguTTCoGlAWDyrDJh1CtZwIVsyBbzERX63vRtFtjxjI,1054
|
|
36
|
-
payi/resources/experiences/experiences.py,sha256=
|
|
36
|
+
payi/resources/experiences/experiences.py,sha256=xfSX_uF1q2-RRie-kwf4P3SyShEjTDwDYN1JQ9wt9Ts,12686
|
|
37
37
|
payi/resources/experiences/types.py,sha256=e47Uhwq1Tj7HedKKOs2UOhWuGq92MVi1SSwucRz_vsI,17464
|
|
38
38
|
payi/types/__init__.py,sha256=7zBCxYcYlvjAIecjsz9nw-LqsMAMXakYhTRJwXUTneo,1803
|
|
39
39
|
payi/types/budget_create_params.py,sha256=3PziVJT3_ll-6yv3i5EF8ERm19jFJAKbv9v-CvRW5ik,653
|
|
@@ -51,11 +51,11 @@ payi/types/category_response.py,sha256=43i8bii20Sb-z9R5M1Ia6RGfRZmdQqsWPlv4Bl1XQ
|
|
|
51
51
|
payi/types/cost_data.py,sha256=jZtju_3WWNXh4wCu77XnyvxZkvewcvXBS_V0z07BizA,284
|
|
52
52
|
payi/types/cost_details.py,sha256=3ldvnYILAG6Sz9wGWMs1SZvIfdGEbn5i4-CauWEXMPA,265
|
|
53
53
|
payi/types/default_response.py,sha256=o617LpRsCIZHCZxAc5nVI2JQ3HPGZo4gCDvSDkxkIJ8,270
|
|
54
|
-
payi/types/experience_instance.py,sha256=
|
|
54
|
+
payi/types/experience_instance.py,sha256=qcG55W-ok341voIoGFIYGCcqfb2w7MLAS033xgT0ags,238
|
|
55
55
|
payi/types/ingest_bulk_params.py,sha256=aIsugHkiAe_DnGQ8JVpDUDYr1YNzR5cUY9mMPqusIP0,381
|
|
56
|
-
payi/types/ingest_event_param.py,sha256=
|
|
56
|
+
payi/types/ingest_event_param.py,sha256=0am1vo5ycVREaE2mPLHy-Qmt0vIGi0UzN0br_EBeYZs,712
|
|
57
57
|
payi/types/ingest_response.py,sha256=o43RH25dS4S54OCr3vkipZvLeAmI-hru6LuL789iEnM,1071
|
|
58
|
-
payi/types/ingest_units_params.py,sha256=
|
|
58
|
+
payi/types/ingest_units_params.py,sha256=WHxiSuEwstcLs48lg5YmyNPGmeKkB_GUKCgAeF-U0is,920
|
|
59
59
|
payi/types/paged_budget_list.py,sha256=FqKlbAifEWY3sZqiJSny-XtS-XIfmj14AufNffNVmqM,1385
|
|
60
60
|
payi/types/requests_data.py,sha256=UniFVu9SgDQIbZupzrLSrvBKV487_iKFemLw9nRDhGo,296
|
|
61
61
|
payi/types/total_cost_data.py,sha256=Nu1LyV1NX4CsI02Yn3GbvNXVZPrXG8U4Fs55rZE9KJk,603
|
|
@@ -77,7 +77,7 @@ payi/types/experiences/experience_type.py,sha256=KKjkfI0eaoB1TmTlA4UpHKa2fB1q0zX
|
|
|
77
77
|
payi/types/experiences/type_create_params.py,sha256=8dNpffodzeD5vm3s6UJrZVOG7YsiTkXo7viDnoEoCZY,311
|
|
78
78
|
payi/types/experiences/type_list_response.py,sha256=DgkPLw40oUqBETLePVMVenstMsGG12rZRU9w6kgQN28,280
|
|
79
79
|
payi/types/experiences/type_update_params.py,sha256=ziUJASn8QF_5nSp5lohT0HLK0tTOciT-X35CVH9dA5Q,329
|
|
80
|
-
payi-0.1.
|
|
81
|
-
payi-0.1.
|
|
82
|
-
payi-0.1.
|
|
83
|
-
payi-0.1.
|
|
80
|
+
payi-0.1.0a20.dist-info/METADATA,sha256=8z52RE1tTAfDyHHnld9U694xpjZo7vX4aYXdPMKGdKI,12006
|
|
81
|
+
payi-0.1.0a20.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
82
|
+
payi-0.1.0a20.dist-info/licenses/LICENSE,sha256=8vX1pjh3esb6D5DvXAf6NxiBcVyon8aHWNJCxmmHXeY,11334
|
|
83
|
+
payi-0.1.0a20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|