paid-python 1.0.0a0__tar.gz → 1.0.0a2__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.
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/PKG-INFO +23 -8
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/README.md +21 -7
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/pyproject.toml +3 -1
- paid_python-1.0.0a2/src/paid/__init__.py +102 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/client.py +16 -22
- paid_python-1.0.0a2/src/paid/contacts/client.py +828 -0
- paid_python-1.0.0a2/src/paid/contacts/raw_client.py +1462 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/client_wrapper.py +8 -10
- paid_python-1.0.0a2/src/paid/customers/client.py +912 -0
- paid_python-1.0.0a2/src/paid/customers/raw_client.py +1552 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/environment.py +1 -1
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/errors/bad_request_error.py +2 -2
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/errors/forbidden_error.py +2 -2
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/errors/internal_server_error.py +2 -2
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/errors/not_found_error.py +2 -2
- paid_python-1.0.0a2/src/paid/invoices/client.py +369 -0
- {paid_python-1.0.0a0/src/paid/plans → paid_python-1.0.0a2/src/paid/invoices}/raw_client.py +312 -201
- paid_python-1.0.0a2/src/paid/orders/client.py +702 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/orders/raw_client.py +552 -537
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/products/client.py +129 -265
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/products/raw_client.py +565 -233
- paid_python-1.0.0a2/src/paid/signals/__init__.py +4 -0
- paid_python-1.0.0a2/src/paid/signals/client.py +130 -0
- paid_python-1.0.0a2/src/paid/signals/raw_client.py +190 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/autoinstrumentation.py +12 -6
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/context_manager.py +2 -6
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/distributed_tracing.py +3 -3
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/signal.py +3 -3
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
- paid_python-1.0.0a2/src/paid/types/__init__.py +81 -0
- paid_python-1.0.0a2/src/paid/types/attribution.py +8 -0
- paid_python-1.0.0a0/src/paid/types/agent_attribute.py → paid_python-1.0.0a2/src/paid/types/bulk_signals_response.py +4 -5
- paid_python-1.0.0a0/src/paid/types/contact_create_for_customer.py → paid_python-1.0.0a2/src/paid/types/contact.py +10 -13
- paid_python-1.0.0a0/src/paid/types/address.py → paid_python-1.0.0a2/src/paid/types/contact_billing_address.py +6 -7
- paid_python-1.0.0a0/src/paid/types/cost_amount.py → paid_python-1.0.0a2/src/paid/types/contact_list_response.py +5 -14
- paid_python-1.0.0a2/src/paid/types/customer.py +39 -0
- paid_python-1.0.0a2/src/paid/types/customer_attribution.py +8 -0
- paid_python-1.0.0a2/src/paid/types/customer_billing_address.py +26 -0
- paid_python-1.0.0a0/src/paid/types/usage_summary_order.py → paid_python-1.0.0a2/src/paid/types/customer_by_external_id.py +3 -5
- paid_python-1.0.0a0/src/paid/types/usage_summary_order_line.py → paid_python-1.0.0a2/src/paid/types/customer_by_id.py +3 -5
- paid_python-1.0.0a2/src/paid/types/customer_creation_state.py +5 -0
- paid_python-1.0.0a2/src/paid/types/customer_list_response.py +22 -0
- paid_python-1.0.0a2/src/paid/types/empty_response.py +17 -0
- paid_python-1.0.0a0/src/paid/types/error.py → paid_python-1.0.0a2/src/paid/types/error_response.py +4 -7
- paid_python-1.0.0a2/src/paid/types/invoice.py +57 -0
- paid_python-1.0.0a2/src/paid/types/invoice_line.py +42 -0
- paid_python-1.0.0a2/src/paid/types/invoice_line_payment_status.py +7 -0
- paid_python-1.0.0a2/src/paid/types/invoice_lines_response.py +22 -0
- paid_python-1.0.0a2/src/paid/types/invoice_list_response.py +22 -0
- paid_python-1.0.0a2/src/paid/types/invoice_payment_status.py +5 -0
- paid_python-1.0.0a2/src/paid/types/invoice_source.py +5 -0
- paid_python-1.0.0a2/src/paid/types/invoice_status.py +7 -0
- paid_python-1.0.0a2/src/paid/types/invoice_tax_status.py +7 -0
- paid_python-1.0.0a2/src/paid/types/order.py +50 -0
- paid_python-1.0.0a2/src/paid/types/order_creation_state.py +5 -0
- paid_python-1.0.0a0/src/paid/types/agent_price_point_tiers.py → paid_python-1.0.0a2/src/paid/types/order_line.py +8 -4
- paid_python-1.0.0a2/src/paid/types/order_lines_response.py +22 -0
- paid_python-1.0.0a2/src/paid/types/order_list_response.py +22 -0
- paid_python-1.0.0a2/src/paid/types/pagination.py +24 -0
- paid_python-1.0.0a0/src/paid/types/agent.py → paid_python-1.0.0a2/src/paid/types/product.py +8 -8
- paid_python-1.0.0a0/src/paid/types/tier.py → paid_python-1.0.0a2/src/paid/types/product_by_external_id.py +5 -4
- paid_python-1.0.0a0/src/paid/types/traces_response.py → paid_python-1.0.0a2/src/paid/types/product_by_id.py +5 -7
- paid_python-1.0.0a2/src/paid/types/product_list_response.py +22 -0
- paid_python-1.0.0a0/src/paid/types/price_point.py → paid_python-1.0.0a2/src/paid/types/signal.py +8 -6
- paid_python-1.0.0a0/src/paid/types/contact.py → paid_python-1.0.0a2/src/paid/types/update_contact_request.py +5 -17
- paid_python-1.0.0a2/src/paid/types/update_customer_request.py +38 -0
- paid_python-1.0.0a0/src/paid/types/product_update.py → paid_python-1.0.0a2/src/paid/types/update_product_request.py +2 -12
- paid_python-1.0.0a0/src/paid/__init__.py +0 -163
- paid_python-1.0.0a0/src/paid/agents/client.py +0 -880
- paid_python-1.0.0a0/src/paid/agents/raw_client.py +0 -785
- paid_python-1.0.0a0/src/paid/contacts/client.py +0 -544
- paid_python-1.0.0a0/src/paid/contacts/raw_client.py +0 -532
- paid_python-1.0.0a0/src/paid/customers/__init__.py +0 -7
- paid_python-1.0.0a0/src/paid/customers/client.py +0 -1630
- paid_python-1.0.0a0/src/paid/customers/raw_client.py +0 -1950
- paid_python-1.0.0a0/src/paid/customers/types/__init__.py +0 -8
- paid_python-1.0.0a0/src/paid/customers/types/customers_check_entitlement_request_view.py +0 -5
- paid_python-1.0.0a0/src/paid/customers/types/customers_check_entitlement_response.py +0 -22
- paid_python-1.0.0a0/src/paid/orders/__init__.py +0 -7
- paid_python-1.0.0a0/src/paid/orders/client.py +0 -892
- paid_python-1.0.0a0/src/paid/orders/lines/client.py +0 -144
- paid_python-1.0.0a0/src/paid/orders/lines/raw_client.py +0 -129
- paid_python-1.0.0a0/src/paid/plans/client.py +0 -403
- paid_python-1.0.0a0/src/paid/products/__init__.py +0 -7
- paid_python-1.0.0a0/src/paid/products/types/__init__.py +0 -7
- paid_python-1.0.0a0/src/paid/products/types/product_create_type.py +0 -5
- paid_python-1.0.0a0/src/paid/traces/client.py +0 -218
- paid_python-1.0.0a0/src/paid/traces/raw_client.py +0 -226
- paid_python-1.0.0a0/src/paid/types/__init__.py +0 -133
- paid_python-1.0.0a0/src/paid/types/agent_price_point.py +0 -27
- paid_python-1.0.0a0/src/paid/types/agent_update.py +0 -29
- paid_python-1.0.0a0/src/paid/types/api_error.py +0 -29
- paid_python-1.0.0a0/src/paid/types/billing_frequency.py +0 -5
- paid_python-1.0.0a0/src/paid/types/cancel_renewal_response.py +0 -49
- paid_python-1.0.0a0/src/paid/types/charge_type.py +0 -5
- paid_python-1.0.0a0/src/paid/types/cost_trace.py +0 -55
- paid_python-1.0.0a0/src/paid/types/cost_traces_response.py +0 -26
- paid_python-1.0.0a0/src/paid/types/creation_source.py +0 -5
- paid_python-1.0.0a0/src/paid/types/creation_state.py +0 -5
- paid_python-1.0.0a0/src/paid/types/customer.py +0 -46
- paid_python-1.0.0a0/src/paid/types/customer_update.py +0 -40
- paid_python-1.0.0a0/src/paid/types/entitlement_usage.py +0 -48
- paid_python-1.0.0a0/src/paid/types/invoice.py +0 -75
- paid_python-1.0.0a0/src/paid/types/invoice_status.py +0 -5
- paid_python-1.0.0a0/src/paid/types/order.py +0 -49
- paid_python-1.0.0a0/src/paid/types/order_line.py +0 -45
- paid_python-1.0.0a0/src/paid/types/order_line_attribute.py +0 -27
- paid_python-1.0.0a0/src/paid/types/order_line_attribute_create_one.py +0 -5
- paid_python-1.0.0a0/src/paid/types/order_line_attribute_pricing.py +0 -33
- paid_python-1.0.0a0/src/paid/types/order_line_create.py +0 -72
- paid_python-1.0.0a0/src/paid/types/pagination_meta.py +0 -84
- paid_python-1.0.0a0/src/paid/types/payment_method.py +0 -58
- paid_python-1.0.0a0/src/paid/types/payment_method_card.py +0 -49
- paid_python-1.0.0a0/src/paid/types/payment_method_type.py +0 -5
- paid_python-1.0.0a0/src/paid/types/payment_method_us_bank_account.py +0 -36
- paid_python-1.0.0a0/src/paid/types/payment_method_us_bank_account_account_type.py +0 -5
- paid_python-1.0.0a0/src/paid/types/plan.py +0 -81
- paid_python-1.0.0a0/src/paid/types/plan_group.py +0 -60
- paid_python-1.0.0a0/src/paid/types/plan_plan_products_item.py +0 -41
- paid_python-1.0.0a0/src/paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
- paid_python-1.0.0a0/src/paid/types/plan_with_features.py +0 -69
- paid_python-1.0.0a0/src/paid/types/plan_with_features_features_item.py +0 -34
- paid_python-1.0.0a0/src/paid/types/pricing.py +0 -31
- paid_python-1.0.0a0/src/paid/types/pricing_model_type.py +0 -7
- paid_python-1.0.0a0/src/paid/types/product.py +0 -56
- paid_python-1.0.0a0/src/paid/types/product_type.py +0 -5
- paid_python-1.0.0a0/src/paid/types/product_update_type.py +0 -5
- paid_python-1.0.0a0/src/paid/types/proration_attribute_update.py +0 -44
- paid_python-1.0.0a0/src/paid/types/proration_detail.py +0 -49
- paid_python-1.0.0a0/src/paid/types/proration_upgrade_response.py +0 -73
- paid_python-1.0.0a0/src/paid/types/salutation.py +0 -5
- paid_python-1.0.0a0/src/paid/types/signal.py +0 -53
- paid_python-1.0.0a0/src/paid/types/signal_v_2.py +0 -56
- paid_python-1.0.0a0/src/paid/types/tax_exempt_status.py +0 -5
- paid_python-1.0.0a0/src/paid/types/trace.py +0 -69
- paid_python-1.0.0a0/src/paid/types/usage_pagination_meta.py +0 -43
- paid_python-1.0.0a0/src/paid/types/usage_summaries_response.py +0 -26
- paid_python-1.0.0a0/src/paid/types/usage_summary.py +0 -121
- paid_python-1.0.0a0/src/paid/usage/__init__.py +0 -7
- paid_python-1.0.0a0/src/paid/usage/client.py +0 -321
- paid_python-1.0.0a0/src/paid/usage/raw_client.py +0 -387
- paid_python-1.0.0a0/src/paid/usage/types/__init__.py +0 -7
- paid_python-1.0.0a0/src/paid/usage/types/usage_check_usage_response.py +0 -53
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/LICENSE +0 -0
- {paid_python-1.0.0a0/src/paid/agents → paid_python-1.0.0a2/src/paid/contacts}/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/api_error.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/datetime_utils.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/file.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/force_multipart.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/http_client.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/http_response.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/jsonable_encoder.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/pydantic_utilities.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/query_encoder.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/remove_none_from_dict.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/request_options.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/core/serialization.py +0 -0
- {paid_python-1.0.0a0/src/paid/contacts → paid_python-1.0.0a2/src/paid/customers}/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/errors/__init__.py +0 -0
- {paid_python-1.0.0a0/src/paid/orders/lines → paid_python-1.0.0a2/src/paid/invoices}/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/logger.py +0 -0
- {paid_python-1.0.0a0/src/paid/plans → paid_python-1.0.0a2/src/paid/orders}/__init__.py +0 -0
- {paid_python-1.0.0a0/src/paid/traces → paid_python-1.0.0a2/src/paid/products}/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/py.typed +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/context_data.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/tracing.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/anthropic/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/anthropic/anthropicWrapper.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/bedrock/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/bedrock/bedrockWrapper.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/gemini/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/gemini/geminiWrapper.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/langchain/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/langchain/paidLangChainCallback.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/llamaindex/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/llamaindex/llamaIndexWrapper.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/mistral/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/mistral/mistralWrapper.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/openai/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/openai/openAiWrapper.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/openai_agents/__init__.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/tracing/wrappers/utils.py +0 -0
- {paid_python-1.0.0a0 → paid_python-1.0.0a2}/src/paid/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: paid-python
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0a2
|
|
4
4
|
Summary:
|
|
5
5
|
Requires-Python: >=3.9,<3.14
|
|
6
6
|
Classifier: Intended Audience :: Developers
|
|
@@ -22,6 +22,7 @@ Requires-Dist: httpx (>=0.21.2)
|
|
|
22
22
|
Requires-Dist: mutagen (>=1.47.0)
|
|
23
23
|
Requires-Dist: openinference-instrumentation-bedrock (>=0.1.0)
|
|
24
24
|
Requires-Dist: openinference-instrumentation-google-genai (>=0.1.8)
|
|
25
|
+
Requires-Dist: openinference-instrumentation-instructor (>=0.1.0)
|
|
25
26
|
Requires-Dist: openinference-instrumentation-langchain (>=0.1.55)
|
|
26
27
|
Requires-Dist: openinference-instrumentation-openai-agents (>=1.0.0)
|
|
27
28
|
Requires-Dist: opentelemetry-api (>=1.23.0)
|
|
@@ -78,7 +79,7 @@ from paid import Paid
|
|
|
78
79
|
|
|
79
80
|
client = Paid(token="API_KEY")
|
|
80
81
|
|
|
81
|
-
client.customers.
|
|
82
|
+
client.customers.create_a_new_customer(
|
|
82
83
|
name="name"
|
|
83
84
|
)
|
|
84
85
|
```
|
|
@@ -89,7 +90,7 @@ The SDK provides Python classes for all request and response types. These are au
|
|
|
89
90
|
|
|
90
91
|
```python
|
|
91
92
|
# Example of creating a customer
|
|
92
|
-
response = client.customers.
|
|
93
|
+
response = client.customers.create_a_new_customer(
|
|
93
94
|
name="John Doe",
|
|
94
95
|
)
|
|
95
96
|
|
|
@@ -103,13 +104,21 @@ print(response.email)
|
|
|
103
104
|
When the API returns a non-success status code (4xx or 5xx response), the SDK will raise an appropriate error.
|
|
104
105
|
|
|
105
106
|
```python
|
|
107
|
+
from paid import BadRequestError, NotFoundError
|
|
108
|
+
from paid.core.api_error import ApiError
|
|
109
|
+
|
|
106
110
|
try:
|
|
107
|
-
client.customers.
|
|
108
|
-
except
|
|
111
|
+
client.customers.create_a_new_customer(name="John Doe")
|
|
112
|
+
except BadRequestError as e:
|
|
113
|
+
print(e.status_code) # 400
|
|
114
|
+
print(e.body) # ErrorResponse with error details
|
|
115
|
+
except NotFoundError as e:
|
|
116
|
+
print(e.status_code) # 404
|
|
117
|
+
print(e.body)
|
|
118
|
+
except ApiError as e:
|
|
119
|
+
# Catch-all for other API errors
|
|
109
120
|
print(e.status_code)
|
|
110
|
-
print(e.message)
|
|
111
121
|
print(e.body)
|
|
112
|
-
print(e.raw_response)
|
|
113
122
|
```
|
|
114
123
|
|
|
115
124
|
## Logging
|
|
@@ -154,6 +163,7 @@ export PAID_ENABLED=false
|
|
|
154
163
|
```
|
|
155
164
|
|
|
156
165
|
This is useful for:
|
|
166
|
+
|
|
157
167
|
- Development/testing environments where tracing isn't needed
|
|
158
168
|
- Temporarily disabling tracing without modifying code
|
|
159
169
|
- Feature flagging in different deployment environments
|
|
@@ -215,11 +225,13 @@ Both approaches:
|
|
|
215
225
|
- Support the same parameters: `external_customer_id`, `external_product_id`, `tracing_token`, `store_prompt`, `metadata`
|
|
216
226
|
|
|
217
227
|
* Note - if it happens that you're calling `paid_tracing` from non-main thread, then it's advised to initialize from main thread:
|
|
228
|
+
|
|
218
229
|
```python
|
|
219
230
|
from paid.tracing import initialize_tracing
|
|
220
231
|
initialize_tracing()
|
|
221
232
|
```
|
|
222
|
-
|
|
233
|
+
|
|
234
|
+
- `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
|
|
223
235
|
|
|
224
236
|
### Using the Paid wrappers
|
|
225
237
|
|
|
@@ -302,6 +314,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
|
|
|
302
314
|
|
|
303
315
|
process_event(incoming_event)
|
|
304
316
|
```
|
|
317
|
+
|
|
305
318
|
</Tab>
|
|
306
319
|
|
|
307
320
|
<Tab title="Python - Context Manager">
|
|
@@ -336,6 +349,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
|
|
|
336
349
|
):
|
|
337
350
|
process_event(incoming_event)
|
|
338
351
|
```
|
|
352
|
+
|
|
339
353
|
</Tab>
|
|
340
354
|
|
|
341
355
|
<Tab title="Node.js">
|
|
@@ -772,6 +786,7 @@ await do_work()
|
|
|
772
786
|
### Paid OTEL Tracer Provider
|
|
773
787
|
|
|
774
788
|
If you would like to use the Paid OTEL tracer provider:
|
|
789
|
+
|
|
775
790
|
```python
|
|
776
791
|
from paid.tracing import get_paid_tracer_provider
|
|
777
792
|
paid_tracer_provider = get_paid_tracer_provider()
|
|
@@ -41,7 +41,7 @@ from paid import Paid
|
|
|
41
41
|
|
|
42
42
|
client = Paid(token="API_KEY")
|
|
43
43
|
|
|
44
|
-
client.customers.
|
|
44
|
+
client.customers.create_a_new_customer(
|
|
45
45
|
name="name"
|
|
46
46
|
)
|
|
47
47
|
```
|
|
@@ -52,7 +52,7 @@ The SDK provides Python classes for all request and response types. These are au
|
|
|
52
52
|
|
|
53
53
|
```python
|
|
54
54
|
# Example of creating a customer
|
|
55
|
-
response = client.customers.
|
|
55
|
+
response = client.customers.create_a_new_customer(
|
|
56
56
|
name="John Doe",
|
|
57
57
|
)
|
|
58
58
|
|
|
@@ -66,13 +66,21 @@ print(response.email)
|
|
|
66
66
|
When the API returns a non-success status code (4xx or 5xx response), the SDK will raise an appropriate error.
|
|
67
67
|
|
|
68
68
|
```python
|
|
69
|
+
from paid import BadRequestError, NotFoundError
|
|
70
|
+
from paid.core.api_error import ApiError
|
|
71
|
+
|
|
69
72
|
try:
|
|
70
|
-
client.customers.
|
|
71
|
-
except
|
|
73
|
+
client.customers.create_a_new_customer(name="John Doe")
|
|
74
|
+
except BadRequestError as e:
|
|
75
|
+
print(e.status_code) # 400
|
|
76
|
+
print(e.body) # ErrorResponse with error details
|
|
77
|
+
except NotFoundError as e:
|
|
78
|
+
print(e.status_code) # 404
|
|
79
|
+
print(e.body)
|
|
80
|
+
except ApiError as e:
|
|
81
|
+
# Catch-all for other API errors
|
|
72
82
|
print(e.status_code)
|
|
73
|
-
print(e.message)
|
|
74
83
|
print(e.body)
|
|
75
|
-
print(e.raw_response)
|
|
76
84
|
```
|
|
77
85
|
|
|
78
86
|
## Logging
|
|
@@ -117,6 +125,7 @@ export PAID_ENABLED=false
|
|
|
117
125
|
```
|
|
118
126
|
|
|
119
127
|
This is useful for:
|
|
128
|
+
|
|
120
129
|
- Development/testing environments where tracing isn't needed
|
|
121
130
|
- Temporarily disabling tracing without modifying code
|
|
122
131
|
- Feature flagging in different deployment environments
|
|
@@ -178,11 +187,13 @@ Both approaches:
|
|
|
178
187
|
- Support the same parameters: `external_customer_id`, `external_product_id`, `tracing_token`, `store_prompt`, `metadata`
|
|
179
188
|
|
|
180
189
|
* Note - if it happens that you're calling `paid_tracing` from non-main thread, then it's advised to initialize from main thread:
|
|
190
|
+
|
|
181
191
|
```python
|
|
182
192
|
from paid.tracing import initialize_tracing
|
|
183
193
|
initialize_tracing()
|
|
184
194
|
```
|
|
185
|
-
|
|
195
|
+
|
|
196
|
+
- `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
|
|
186
197
|
|
|
187
198
|
### Using the Paid wrappers
|
|
188
199
|
|
|
@@ -265,6 +276,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
|
|
|
265
276
|
|
|
266
277
|
process_event(incoming_event)
|
|
267
278
|
```
|
|
279
|
+
|
|
268
280
|
</Tab>
|
|
269
281
|
|
|
270
282
|
<Tab title="Python - Context Manager">
|
|
@@ -299,6 +311,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
|
|
|
299
311
|
):
|
|
300
312
|
process_event(incoming_event)
|
|
301
313
|
```
|
|
314
|
+
|
|
302
315
|
</Tab>
|
|
303
316
|
|
|
304
317
|
<Tab title="Node.js">
|
|
@@ -735,6 +748,7 @@ await do_work()
|
|
|
735
748
|
### Paid OTEL Tracer Provider
|
|
736
749
|
|
|
737
750
|
If you would like to use the Paid OTEL tracer provider:
|
|
751
|
+
|
|
738
752
|
```python
|
|
739
753
|
from paid.tracing import get_paid_tracer_provider
|
|
740
754
|
paid_tracer_provider = get_paid_tracer_provider()
|
|
@@ -3,7 +3,7 @@ name = "paid-python"
|
|
|
3
3
|
|
|
4
4
|
[tool.poetry]
|
|
5
5
|
name = "paid-python"
|
|
6
|
-
version = "1.0.0-
|
|
6
|
+
version = "1.0.0-alpha2"
|
|
7
7
|
description = ""
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
authors = []
|
|
@@ -39,6 +39,7 @@ httpx = ">=0.21.2"
|
|
|
39
39
|
mutagen = ">=1.47.0"
|
|
40
40
|
openinference-instrumentation-bedrock = ">=0.1.0"
|
|
41
41
|
openinference-instrumentation-google-genai = ">=0.1.8"
|
|
42
|
+
openinference-instrumentation-instructor = ">=0.1.0"
|
|
42
43
|
openinference-instrumentation-langchain = ">=0.1.55"
|
|
43
44
|
openinference-instrumentation-openai-agents = ">=1.0.0"
|
|
44
45
|
opentelemetry-api = ">=1.23.0"
|
|
@@ -59,6 +60,7 @@ python-dateutil = "^2.9.0"
|
|
|
59
60
|
types-python-dateutil = "^2.9.0.20240316"
|
|
60
61
|
anthropic = ">=0.57.0"
|
|
61
62
|
google-genai = ">=1.19.0"
|
|
63
|
+
instructor = ">=1.0.0"
|
|
62
64
|
langchain-core = ">=0.1.0"
|
|
63
65
|
llama-index-core = ">=0.13.0"
|
|
64
66
|
llama-index-llms-openai = ">=0.5.0"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
from .types import (
|
|
6
|
+
Attribution,
|
|
7
|
+
BulkSignalsResponse,
|
|
8
|
+
Contact,
|
|
9
|
+
ContactBillingAddress,
|
|
10
|
+
ContactListResponse,
|
|
11
|
+
Customer,
|
|
12
|
+
CustomerAttribution,
|
|
13
|
+
CustomerBillingAddress,
|
|
14
|
+
CustomerByExternalId,
|
|
15
|
+
CustomerById,
|
|
16
|
+
CustomerCreationState,
|
|
17
|
+
CustomerListResponse,
|
|
18
|
+
EmptyResponse,
|
|
19
|
+
ErrorResponse,
|
|
20
|
+
Invoice,
|
|
21
|
+
InvoiceLine,
|
|
22
|
+
InvoiceLinePaymentStatus,
|
|
23
|
+
InvoiceLinesResponse,
|
|
24
|
+
InvoiceListResponse,
|
|
25
|
+
InvoicePaymentStatus,
|
|
26
|
+
InvoiceSource,
|
|
27
|
+
InvoiceStatus,
|
|
28
|
+
InvoiceTaxStatus,
|
|
29
|
+
Order,
|
|
30
|
+
OrderCreationState,
|
|
31
|
+
OrderLine,
|
|
32
|
+
OrderLinesResponse,
|
|
33
|
+
OrderListResponse,
|
|
34
|
+
Pagination,
|
|
35
|
+
Product,
|
|
36
|
+
ProductByExternalId,
|
|
37
|
+
ProductById,
|
|
38
|
+
ProductListResponse,
|
|
39
|
+
Signal,
|
|
40
|
+
UpdateContactRequest,
|
|
41
|
+
UpdateCustomerRequest,
|
|
42
|
+
UpdateProductRequest,
|
|
43
|
+
)
|
|
44
|
+
from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError
|
|
45
|
+
from . import contacts, customers, invoices, orders, products, signals
|
|
46
|
+
from .client import AsyncPaid, Paid
|
|
47
|
+
from .environment import PaidEnvironment
|
|
48
|
+
from .version import __version__
|
|
49
|
+
|
|
50
|
+
__all__ = [
|
|
51
|
+
"AsyncPaid",
|
|
52
|
+
"Attribution",
|
|
53
|
+
"BadRequestError",
|
|
54
|
+
"BulkSignalsResponse",
|
|
55
|
+
"Contact",
|
|
56
|
+
"ContactBillingAddress",
|
|
57
|
+
"ContactListResponse",
|
|
58
|
+
"Customer",
|
|
59
|
+
"CustomerAttribution",
|
|
60
|
+
"CustomerBillingAddress",
|
|
61
|
+
"CustomerByExternalId",
|
|
62
|
+
"CustomerById",
|
|
63
|
+
"CustomerCreationState",
|
|
64
|
+
"CustomerListResponse",
|
|
65
|
+
"EmptyResponse",
|
|
66
|
+
"ErrorResponse",
|
|
67
|
+
"ForbiddenError",
|
|
68
|
+
"InternalServerError",
|
|
69
|
+
"Invoice",
|
|
70
|
+
"InvoiceLine",
|
|
71
|
+
"InvoiceLinePaymentStatus",
|
|
72
|
+
"InvoiceLinesResponse",
|
|
73
|
+
"InvoiceListResponse",
|
|
74
|
+
"InvoicePaymentStatus",
|
|
75
|
+
"InvoiceSource",
|
|
76
|
+
"InvoiceStatus",
|
|
77
|
+
"InvoiceTaxStatus",
|
|
78
|
+
"NotFoundError",
|
|
79
|
+
"Order",
|
|
80
|
+
"OrderCreationState",
|
|
81
|
+
"OrderLine",
|
|
82
|
+
"OrderLinesResponse",
|
|
83
|
+
"OrderListResponse",
|
|
84
|
+
"Pagination",
|
|
85
|
+
"Paid",
|
|
86
|
+
"PaidEnvironment",
|
|
87
|
+
"Product",
|
|
88
|
+
"ProductByExternalId",
|
|
89
|
+
"ProductById",
|
|
90
|
+
"ProductListResponse",
|
|
91
|
+
"Signal",
|
|
92
|
+
"UpdateContactRequest",
|
|
93
|
+
"UpdateCustomerRequest",
|
|
94
|
+
"UpdateProductRequest",
|
|
95
|
+
"__version__",
|
|
96
|
+
"contacts",
|
|
97
|
+
"customers",
|
|
98
|
+
"invoices",
|
|
99
|
+
"orders",
|
|
100
|
+
"products",
|
|
101
|
+
"signals",
|
|
102
|
+
]
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
5
|
import httpx
|
|
6
|
-
from .agents.client import AgentsClient, AsyncAgentsClient
|
|
7
6
|
from .contacts.client import AsyncContactsClient, ContactsClient
|
|
8
7
|
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
8
|
from .customers.client import AsyncCustomersClient, CustomersClient
|
|
10
9
|
from .environment import PaidEnvironment
|
|
10
|
+
from .invoices.client import AsyncInvoicesClient, InvoicesClient
|
|
11
11
|
from .orders.client import AsyncOrdersClient, OrdersClient
|
|
12
|
-
from .plans.client import AsyncPlansClient, PlansClient
|
|
13
12
|
from .products.client import AsyncProductsClient, ProductsClient
|
|
14
|
-
from .
|
|
15
|
-
from .usage.client import AsyncUsageClient, UsageClient
|
|
13
|
+
from .signals.client import AsyncSignalsClient, SignalsClient
|
|
16
14
|
|
|
17
15
|
|
|
18
16
|
class Paid:
|
|
@@ -29,11 +27,11 @@ class Paid:
|
|
|
29
27
|
|
|
30
28
|
|
|
31
29
|
|
|
32
|
-
Defaults to PaidEnvironment.
|
|
30
|
+
Defaults to PaidEnvironment.DEFAULT
|
|
33
31
|
|
|
34
32
|
|
|
35
33
|
|
|
36
|
-
token : typing.
|
|
34
|
+
token : typing.Union[str, typing.Callable[[], str]]
|
|
37
35
|
timeout : typing.Optional[float]
|
|
38
36
|
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
39
37
|
|
|
@@ -56,8 +54,8 @@ class Paid:
|
|
|
56
54
|
self,
|
|
57
55
|
*,
|
|
58
56
|
base_url: typing.Optional[str] = None,
|
|
59
|
-
environment: PaidEnvironment = PaidEnvironment.
|
|
60
|
-
token: typing.
|
|
57
|
+
environment: PaidEnvironment = PaidEnvironment.DEFAULT,
|
|
58
|
+
token: typing.Union[str, typing.Callable[[], str]],
|
|
61
59
|
timeout: typing.Optional[float] = None,
|
|
62
60
|
follow_redirects: typing.Optional[bool] = True,
|
|
63
61
|
httpx_client: typing.Optional[httpx.Client] = None,
|
|
@@ -75,14 +73,12 @@ class Paid:
|
|
|
75
73
|
else httpx.Client(timeout=_defaulted_timeout),
|
|
76
74
|
timeout=_defaulted_timeout,
|
|
77
75
|
)
|
|
78
|
-
self.customers = CustomersClient(client_wrapper=self._client_wrapper)
|
|
79
|
-
self.agents = AgentsClient(client_wrapper=self._client_wrapper)
|
|
80
76
|
self.products = ProductsClient(client_wrapper=self._client_wrapper)
|
|
77
|
+
self.customers = CustomersClient(client_wrapper=self._client_wrapper)
|
|
81
78
|
self.contacts = ContactsClient(client_wrapper=self._client_wrapper)
|
|
82
79
|
self.orders = OrdersClient(client_wrapper=self._client_wrapper)
|
|
83
|
-
self.
|
|
84
|
-
self.
|
|
85
|
-
self.traces = TracesClient(client_wrapper=self._client_wrapper)
|
|
80
|
+
self.invoices = InvoicesClient(client_wrapper=self._client_wrapper)
|
|
81
|
+
self.signals = SignalsClient(client_wrapper=self._client_wrapper)
|
|
86
82
|
|
|
87
83
|
|
|
88
84
|
class AsyncPaid:
|
|
@@ -99,11 +95,11 @@ class AsyncPaid:
|
|
|
99
95
|
|
|
100
96
|
|
|
101
97
|
|
|
102
|
-
Defaults to PaidEnvironment.
|
|
98
|
+
Defaults to PaidEnvironment.DEFAULT
|
|
103
99
|
|
|
104
100
|
|
|
105
101
|
|
|
106
|
-
token : typing.
|
|
102
|
+
token : typing.Union[str, typing.Callable[[], str]]
|
|
107
103
|
timeout : typing.Optional[float]
|
|
108
104
|
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
109
105
|
|
|
@@ -126,8 +122,8 @@ class AsyncPaid:
|
|
|
126
122
|
self,
|
|
127
123
|
*,
|
|
128
124
|
base_url: typing.Optional[str] = None,
|
|
129
|
-
environment: PaidEnvironment = PaidEnvironment.
|
|
130
|
-
token: typing.
|
|
125
|
+
environment: PaidEnvironment = PaidEnvironment.DEFAULT,
|
|
126
|
+
token: typing.Union[str, typing.Callable[[], str]],
|
|
131
127
|
timeout: typing.Optional[float] = None,
|
|
132
128
|
follow_redirects: typing.Optional[bool] = True,
|
|
133
129
|
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
|
@@ -145,14 +141,12 @@ class AsyncPaid:
|
|
|
145
141
|
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
146
142
|
timeout=_defaulted_timeout,
|
|
147
143
|
)
|
|
148
|
-
self.customers = AsyncCustomersClient(client_wrapper=self._client_wrapper)
|
|
149
|
-
self.agents = AsyncAgentsClient(client_wrapper=self._client_wrapper)
|
|
150
144
|
self.products = AsyncProductsClient(client_wrapper=self._client_wrapper)
|
|
145
|
+
self.customers = AsyncCustomersClient(client_wrapper=self._client_wrapper)
|
|
151
146
|
self.contacts = AsyncContactsClient(client_wrapper=self._client_wrapper)
|
|
152
147
|
self.orders = AsyncOrdersClient(client_wrapper=self._client_wrapper)
|
|
153
|
-
self.
|
|
154
|
-
self.
|
|
155
|
-
self.traces = AsyncTracesClient(client_wrapper=self._client_wrapper)
|
|
148
|
+
self.invoices = AsyncInvoicesClient(client_wrapper=self._client_wrapper)
|
|
149
|
+
self.signals = AsyncSignalsClient(client_wrapper=self._client_wrapper)
|
|
156
150
|
|
|
157
151
|
|
|
158
152
|
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: PaidEnvironment) -> str:
|