fauxshield 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.
- fauxshield-0.1.0/.gitignore +146 -0
- fauxshield-0.1.0/PKG-INFO +202 -0
- fauxshield-0.1.0/README.md +173 -0
- fauxshield-0.1.0/fauxshield/__init__.py +62 -0
- fauxshield-0.1.0/fauxshield/client.py +173 -0
- fauxshield-0.1.0/fauxshield/errors.py +182 -0
- fauxshield-0.1.0/fauxshield/http_client.py +329 -0
- fauxshield-0.1.0/fauxshield/pagination.py +118 -0
- fauxshield-0.1.0/fauxshield/resources/__init__.py +23 -0
- fauxshield-0.1.0/fauxshield/resources/api_keys.py +134 -0
- fauxshield-0.1.0/fauxshield/resources/base.py +115 -0
- fauxshield-0.1.0/fauxshield/resources/batches.py +190 -0
- fauxshield-0.1.0/fauxshield/resources/events.py +75 -0
- fauxshield-0.1.0/fauxshield/resources/fraud_alerts.py +128 -0
- fauxshield-0.1.0/fauxshield/resources/identities.py +104 -0
- fauxshield-0.1.0/fauxshield/resources/products.py +174 -0
- fauxshield-0.1.0/fauxshield/resources/webhooks.py +239 -0
- fauxshield-0.1.0/fauxshield/types.py +46 -0
- fauxshield-0.1.0/fauxshield/webhook.py +116 -0
- fauxshield-0.1.0/pyproject.toml +58 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
lerna-debug.log*
|
|
8
|
+
|
|
9
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
10
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
11
|
+
|
|
12
|
+
# Runtime data
|
|
13
|
+
pids
|
|
14
|
+
*.pid
|
|
15
|
+
*.seed
|
|
16
|
+
*.pid.lock
|
|
17
|
+
|
|
18
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
19
|
+
lib-cov
|
|
20
|
+
|
|
21
|
+
# Coverage directory used by tools like istanbul
|
|
22
|
+
coverage
|
|
23
|
+
*.lcov
|
|
24
|
+
|
|
25
|
+
# nyc test coverage
|
|
26
|
+
.nyc_output
|
|
27
|
+
|
|
28
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
29
|
+
.grunt
|
|
30
|
+
|
|
31
|
+
# Bower dependency directory (https://bower.io/)
|
|
32
|
+
bower_components
|
|
33
|
+
|
|
34
|
+
# node-waf configuration
|
|
35
|
+
.lock-wscript
|
|
36
|
+
|
|
37
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
38
|
+
build/Release
|
|
39
|
+
|
|
40
|
+
# Dependency directories
|
|
41
|
+
node_modules/
|
|
42
|
+
jspm_packages/
|
|
43
|
+
|
|
44
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
45
|
+
web_modules/
|
|
46
|
+
|
|
47
|
+
# TypeScript cache
|
|
48
|
+
*.tsbuildinfo
|
|
49
|
+
|
|
50
|
+
# Optional npm cache directory
|
|
51
|
+
.npm
|
|
52
|
+
|
|
53
|
+
# Optional eslint cache
|
|
54
|
+
.eslintcache
|
|
55
|
+
|
|
56
|
+
# Optional stylelint cache
|
|
57
|
+
.stylelintcache
|
|
58
|
+
|
|
59
|
+
# Optional REPL history
|
|
60
|
+
.node_repl_history
|
|
61
|
+
|
|
62
|
+
# Output of 'npm pack'
|
|
63
|
+
*.tgz
|
|
64
|
+
|
|
65
|
+
# Yarn Integrity file
|
|
66
|
+
.yarn-integrity
|
|
67
|
+
|
|
68
|
+
# MaxMind GeoLite2 / GeoIP2 databases
|
|
69
|
+
*.mmdb
|
|
70
|
+
|
|
71
|
+
# dotenv environment variable files
|
|
72
|
+
.env
|
|
73
|
+
.env.*
|
|
74
|
+
!.env.example
|
|
75
|
+
|
|
76
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
77
|
+
.cache
|
|
78
|
+
.parcel-cache
|
|
79
|
+
|
|
80
|
+
# Next.js build output
|
|
81
|
+
.next
|
|
82
|
+
out
|
|
83
|
+
|
|
84
|
+
# Nuxt.js build / generate output
|
|
85
|
+
.nuxt
|
|
86
|
+
dist
|
|
87
|
+
.output
|
|
88
|
+
|
|
89
|
+
# Gatsby files
|
|
90
|
+
.cache/
|
|
91
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
92
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
93
|
+
# public
|
|
94
|
+
|
|
95
|
+
# vuepress build output
|
|
96
|
+
.vuepress/dist
|
|
97
|
+
|
|
98
|
+
# vuepress v2.x temp directory
|
|
99
|
+
.temp
|
|
100
|
+
|
|
101
|
+
# Sveltekit cache directory
|
|
102
|
+
.svelte-kit/
|
|
103
|
+
|
|
104
|
+
# vitepress build output
|
|
105
|
+
**/.vitepress/dist
|
|
106
|
+
|
|
107
|
+
# vitepress cache directory
|
|
108
|
+
**/.vitepress/cache
|
|
109
|
+
|
|
110
|
+
# Docusaurus cache and generated files
|
|
111
|
+
.docusaurus
|
|
112
|
+
|
|
113
|
+
# Serverless directories
|
|
114
|
+
.serverless/
|
|
115
|
+
|
|
116
|
+
# FuseBox cache
|
|
117
|
+
.fusebox/
|
|
118
|
+
|
|
119
|
+
# DynamoDB Local files
|
|
120
|
+
.dynamodb/
|
|
121
|
+
|
|
122
|
+
# Firebase cache directory
|
|
123
|
+
.firebase/
|
|
124
|
+
|
|
125
|
+
# TernJS port file
|
|
126
|
+
.tern-port
|
|
127
|
+
|
|
128
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
129
|
+
.vscode-test
|
|
130
|
+
|
|
131
|
+
# pnpm
|
|
132
|
+
.pnpm-store
|
|
133
|
+
|
|
134
|
+
# yarn v3
|
|
135
|
+
.pnp.*
|
|
136
|
+
.yarn/*
|
|
137
|
+
!.yarn/patches
|
|
138
|
+
!.yarn/plugins
|
|
139
|
+
!.yarn/releases
|
|
140
|
+
!.yarn/sdks
|
|
141
|
+
!.yarn/versions
|
|
142
|
+
|
|
143
|
+
# Vite files
|
|
144
|
+
vite.config.js.timestamp-*
|
|
145
|
+
vite.config.ts.timestamp-*
|
|
146
|
+
.vite/
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: fauxshield
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for the FauxShield anti-counterfeiting platform
|
|
5
|
+
Project-URL: Homepage, https://fauxshield.com
|
|
6
|
+
Project-URL: Documentation, https://docs.fauxshield.com
|
|
7
|
+
Project-URL: Repository, https://github.com/fauxshield/fauxshield-python
|
|
8
|
+
Author-email: FauxShield <support@fauxshield.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: anti-counterfeiting,fauxshield,fraud-detection,product-authentication
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Requires-Dist: httpx<1.0.0,>=0.25.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: respx>=0.20; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# FauxShield Python SDK
|
|
31
|
+
|
|
32
|
+
Official Python client for the [FauxShield](https://fauxshield.com) anti-counterfeiting platform API.
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
- Python 3.9+
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install fauxshield
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or from source:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install -e packages/python-sdk
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from fauxshield import FauxShieldClient
|
|
54
|
+
|
|
55
|
+
client = FauxShieldClient(api_key="fs_live_your_api_key")
|
|
56
|
+
|
|
57
|
+
# List products with auto-pagination
|
|
58
|
+
for product in client.products.list():
|
|
59
|
+
print(product["name"])
|
|
60
|
+
|
|
61
|
+
# Create a product
|
|
62
|
+
product = client.products.create(
|
|
63
|
+
name="Premium Widget",
|
|
64
|
+
sku="WDG-001",
|
|
65
|
+
category="electronics",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# Create a batch
|
|
69
|
+
batch = client.batches.create(
|
|
70
|
+
product_id=product["id"],
|
|
71
|
+
quantity=1000,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Generate identities (QR tokens)
|
|
75
|
+
identities = client.identities.generate(
|
|
76
|
+
batch_id=batch["id"],
|
|
77
|
+
quantity=100,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Check fraud alerts
|
|
81
|
+
for alert in client.fraud_alerts.list(status="open"):
|
|
82
|
+
print(f"Alert: {alert['type']} - {alert['description']}")
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Context Manager
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
with FauxShieldClient(api_key="fs_live_...") as client:
|
|
89
|
+
products = client.products.list().to_list()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Configuration
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
client = FauxShieldClient(
|
|
96
|
+
api_key="fs_live_...",
|
|
97
|
+
base_url="https://fauxshield.vercel.app/api/v1", # default
|
|
98
|
+
timeout=30.0, # request timeout in seconds
|
|
99
|
+
max_retries=3, # retry attempts for 5xx/network errors
|
|
100
|
+
)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Resources
|
|
104
|
+
|
|
105
|
+
| Resource | Methods |
|
|
106
|
+
|----------|---------|
|
|
107
|
+
| `client.products` | `list`, `get`, `create`, `update`, `delete` |
|
|
108
|
+
| `client.batches` | `list`, `get`, `create`, `update`, `recall` |
|
|
109
|
+
| `client.identities` | `list`, `generate` |
|
|
110
|
+
| `client.fraud_alerts` | `list`, `get`, `resolve` |
|
|
111
|
+
| `client.events` | `list` |
|
|
112
|
+
| `client.webhooks` | `list`, `create`, `update`, `delete`, `rotate_secret`, `test`, `list_deliveries` |
|
|
113
|
+
| `client.api_keys` | `list`, `create`, `revoke` |
|
|
114
|
+
|
|
115
|
+
## Pagination
|
|
116
|
+
|
|
117
|
+
All list methods return a `PaginatedIterator` that automatically fetches pages:
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
# Iterate one by one (fetches pages lazily)
|
|
121
|
+
for product in client.products.list(page_size=50):
|
|
122
|
+
process(product)
|
|
123
|
+
|
|
124
|
+
# Or collect all into a list
|
|
125
|
+
all_products = client.products.list().to_list()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Error Handling
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from fauxshield import (
|
|
132
|
+
FauxShieldError,
|
|
133
|
+
AuthenticationError,
|
|
134
|
+
NotFoundError,
|
|
135
|
+
RateLimitError,
|
|
136
|
+
ValidationError,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
try:
|
|
140
|
+
product = client.products.get("nonexistent")
|
|
141
|
+
except NotFoundError as e:
|
|
142
|
+
print(f"Not found: {e.message}")
|
|
143
|
+
except RateLimitError as e:
|
|
144
|
+
print(f"Rate limited. Retry after {e.retry_after}s")
|
|
145
|
+
except ValidationError as e:
|
|
146
|
+
print(f"Invalid request: {e.fields}")
|
|
147
|
+
except AuthenticationError:
|
|
148
|
+
print("Check your API key")
|
|
149
|
+
except FauxShieldError as e:
|
|
150
|
+
print(f"API error [{e.status_code}]: {e.message}")
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Webhook Verification
|
|
154
|
+
|
|
155
|
+
Verify incoming webhook signatures in your endpoint handler:
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
from fauxshield import verify_webhook_signature, WebhookVerificationError
|
|
159
|
+
|
|
160
|
+
try:
|
|
161
|
+
verify_webhook_signature(
|
|
162
|
+
payload=request.body,
|
|
163
|
+
signature=request.headers["X-FauxShield-Signature"],
|
|
164
|
+
secret="whsec_your_webhook_secret",
|
|
165
|
+
tolerance=300, # 5 minute tolerance (default)
|
|
166
|
+
)
|
|
167
|
+
# Signature valid — process the event
|
|
168
|
+
except WebhookVerificationError as e:
|
|
169
|
+
# Reject the request
|
|
170
|
+
print(f"Invalid webhook: {e}")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Rate Limiting
|
|
174
|
+
|
|
175
|
+
The SDK automatically retries on rate limit (429) responses. You can also inspect rate limit info:
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
client.products.list()
|
|
179
|
+
info = client.last_rate_limit
|
|
180
|
+
if info:
|
|
181
|
+
print(f"Remaining: {info['remaining']}/{info['limit']}")
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Development
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Install dev dependencies
|
|
188
|
+
pip install -e "packages/python-sdk[dev]"
|
|
189
|
+
|
|
190
|
+
# Run tests
|
|
191
|
+
pytest
|
|
192
|
+
|
|
193
|
+
# Type checking
|
|
194
|
+
mypy fauxshield/
|
|
195
|
+
|
|
196
|
+
# Linting
|
|
197
|
+
ruff check fauxshield/
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# FauxShield Python SDK
|
|
2
|
+
|
|
3
|
+
Official Python client for the [FauxShield](https://fauxshield.com) anti-counterfeiting platform API.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Python 3.9+
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install fauxshield
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or from source:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install -e packages/python-sdk
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from fauxshield import FauxShieldClient
|
|
25
|
+
|
|
26
|
+
client = FauxShieldClient(api_key="fs_live_your_api_key")
|
|
27
|
+
|
|
28
|
+
# List products with auto-pagination
|
|
29
|
+
for product in client.products.list():
|
|
30
|
+
print(product["name"])
|
|
31
|
+
|
|
32
|
+
# Create a product
|
|
33
|
+
product = client.products.create(
|
|
34
|
+
name="Premium Widget",
|
|
35
|
+
sku="WDG-001",
|
|
36
|
+
category="electronics",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Create a batch
|
|
40
|
+
batch = client.batches.create(
|
|
41
|
+
product_id=product["id"],
|
|
42
|
+
quantity=1000,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# Generate identities (QR tokens)
|
|
46
|
+
identities = client.identities.generate(
|
|
47
|
+
batch_id=batch["id"],
|
|
48
|
+
quantity=100,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
# Check fraud alerts
|
|
52
|
+
for alert in client.fraud_alerts.list(status="open"):
|
|
53
|
+
print(f"Alert: {alert['type']} - {alert['description']}")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Context Manager
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
with FauxShieldClient(api_key="fs_live_...") as client:
|
|
60
|
+
products = client.products.list().to_list()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Configuration
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
client = FauxShieldClient(
|
|
67
|
+
api_key="fs_live_...",
|
|
68
|
+
base_url="https://fauxshield.vercel.app/api/v1", # default
|
|
69
|
+
timeout=30.0, # request timeout in seconds
|
|
70
|
+
max_retries=3, # retry attempts for 5xx/network errors
|
|
71
|
+
)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Resources
|
|
75
|
+
|
|
76
|
+
| Resource | Methods |
|
|
77
|
+
|----------|---------|
|
|
78
|
+
| `client.products` | `list`, `get`, `create`, `update`, `delete` |
|
|
79
|
+
| `client.batches` | `list`, `get`, `create`, `update`, `recall` |
|
|
80
|
+
| `client.identities` | `list`, `generate` |
|
|
81
|
+
| `client.fraud_alerts` | `list`, `get`, `resolve` |
|
|
82
|
+
| `client.events` | `list` |
|
|
83
|
+
| `client.webhooks` | `list`, `create`, `update`, `delete`, `rotate_secret`, `test`, `list_deliveries` |
|
|
84
|
+
| `client.api_keys` | `list`, `create`, `revoke` |
|
|
85
|
+
|
|
86
|
+
## Pagination
|
|
87
|
+
|
|
88
|
+
All list methods return a `PaginatedIterator` that automatically fetches pages:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
# Iterate one by one (fetches pages lazily)
|
|
92
|
+
for product in client.products.list(page_size=50):
|
|
93
|
+
process(product)
|
|
94
|
+
|
|
95
|
+
# Or collect all into a list
|
|
96
|
+
all_products = client.products.list().to_list()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Error Handling
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from fauxshield import (
|
|
103
|
+
FauxShieldError,
|
|
104
|
+
AuthenticationError,
|
|
105
|
+
NotFoundError,
|
|
106
|
+
RateLimitError,
|
|
107
|
+
ValidationError,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
try:
|
|
111
|
+
product = client.products.get("nonexistent")
|
|
112
|
+
except NotFoundError as e:
|
|
113
|
+
print(f"Not found: {e.message}")
|
|
114
|
+
except RateLimitError as e:
|
|
115
|
+
print(f"Rate limited. Retry after {e.retry_after}s")
|
|
116
|
+
except ValidationError as e:
|
|
117
|
+
print(f"Invalid request: {e.fields}")
|
|
118
|
+
except AuthenticationError:
|
|
119
|
+
print("Check your API key")
|
|
120
|
+
except FauxShieldError as e:
|
|
121
|
+
print(f"API error [{e.status_code}]: {e.message}")
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Webhook Verification
|
|
125
|
+
|
|
126
|
+
Verify incoming webhook signatures in your endpoint handler:
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from fauxshield import verify_webhook_signature, WebhookVerificationError
|
|
130
|
+
|
|
131
|
+
try:
|
|
132
|
+
verify_webhook_signature(
|
|
133
|
+
payload=request.body,
|
|
134
|
+
signature=request.headers["X-FauxShield-Signature"],
|
|
135
|
+
secret="whsec_your_webhook_secret",
|
|
136
|
+
tolerance=300, # 5 minute tolerance (default)
|
|
137
|
+
)
|
|
138
|
+
# Signature valid — process the event
|
|
139
|
+
except WebhookVerificationError as e:
|
|
140
|
+
# Reject the request
|
|
141
|
+
print(f"Invalid webhook: {e}")
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Rate Limiting
|
|
145
|
+
|
|
146
|
+
The SDK automatically retries on rate limit (429) responses. You can also inspect rate limit info:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
client.products.list()
|
|
150
|
+
info = client.last_rate_limit
|
|
151
|
+
if info:
|
|
152
|
+
print(f"Remaining: {info['remaining']}/{info['limit']}")
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Development
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Install dev dependencies
|
|
159
|
+
pip install -e "packages/python-sdk[dev]"
|
|
160
|
+
|
|
161
|
+
# Run tests
|
|
162
|
+
pytest
|
|
163
|
+
|
|
164
|
+
# Type checking
|
|
165
|
+
mypy fauxshield/
|
|
166
|
+
|
|
167
|
+
# Linting
|
|
168
|
+
ruff check fauxshield/
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
MIT
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""FauxShield Python SDK.
|
|
2
|
+
|
|
3
|
+
Official Python client for the FauxShield anti-counterfeiting platform API.
|
|
4
|
+
|
|
5
|
+
Quick start:
|
|
6
|
+
```python
|
|
7
|
+
from fauxshield import FauxShieldClient
|
|
8
|
+
|
|
9
|
+
client = FauxShieldClient(api_key="fs_live_...")
|
|
10
|
+
products = client.products.list()
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For webhook verification:
|
|
14
|
+
```python
|
|
15
|
+
from fauxshield import verify_webhook_signature
|
|
16
|
+
|
|
17
|
+
verify_webhook_signature(
|
|
18
|
+
payload=request.body,
|
|
19
|
+
signature=request.headers["X-FauxShield-Signature"],
|
|
20
|
+
secret="whsec_...",
|
|
21
|
+
)
|
|
22
|
+
```
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from .client import FauxShieldClient
|
|
26
|
+
from .errors import (
|
|
27
|
+
AuthenticationError,
|
|
28
|
+
AuthorizationError,
|
|
29
|
+
ConflictError,
|
|
30
|
+
FauxShieldError,
|
|
31
|
+
NotFoundError,
|
|
32
|
+
RateLimitError,
|
|
33
|
+
ServiceUnavailableError,
|
|
34
|
+
ValidationError,
|
|
35
|
+
)
|
|
36
|
+
from .pagination import PaginatedIterator
|
|
37
|
+
from .types import PaginatedResponse, PaginationMeta, RateLimitInfo
|
|
38
|
+
from .webhook import verify_webhook_signature, WebhookVerificationError
|
|
39
|
+
|
|
40
|
+
__version__ = "0.1.0"
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
# Client
|
|
44
|
+
"FauxShieldClient",
|
|
45
|
+
# Errors
|
|
46
|
+
"FauxShieldError",
|
|
47
|
+
"AuthenticationError",
|
|
48
|
+
"AuthorizationError",
|
|
49
|
+
"ValidationError",
|
|
50
|
+
"NotFoundError",
|
|
51
|
+
"RateLimitError",
|
|
52
|
+
"ConflictError",
|
|
53
|
+
"ServiceUnavailableError",
|
|
54
|
+
# Webhook
|
|
55
|
+
"verify_webhook_signature",
|
|
56
|
+
"WebhookVerificationError",
|
|
57
|
+
# Types
|
|
58
|
+
"PaginatedIterator",
|
|
59
|
+
"PaginatedResponse",
|
|
60
|
+
"PaginationMeta",
|
|
61
|
+
"RateLimitInfo",
|
|
62
|
+
]
|