A python SDK for salla integration
Project description
Salla SDK 📦
Installation
$ install python version 3.10
$ pip install salla-python-sdk
$ create a .env and fill all required fields from .env.example.
Supported Features
Feature | Status |
---|---|
Generate Access Token From Code | ✅ |
Generate Access Token From Refresh Token | ✅ |
Retrive Merchant info | ✅ |
Retrive Store info | ✅ |
Subscribe to a webhook URL | ✅ |
Unsubscribe to a webhook by url or id |
✅ |
List all registered and available webhook/s |
✅ |
Examples
import asyncio
from salla import ENV, Refresh_Token_Payload, Salla, Webhook_Events, WebhookPayload
async def main():
s = Salla(ENV.ACCESS_TOKEN)
# Get information about the merchant and print it
await s.get_merchant_info()
# Get information about the store and print it
await s.get_store_info()
# Subscribe to product update events using a webhook
await s.webhook_subscribe(
WebhookPayload(
name="Ryuk-me",
event=Webhook_Events.PRODUCT_UPDATED,
secret=ENV.WEBHOOK_SECRET,
url="https://webhook.site/2453453-123n7bad6va123",
security_strategy="token",
)
)
# Refresh the access token and print the result
await s.get_access_token_from_refresh_token(
Refresh_Token_Payload(
client_id=ENV.CLIENT_ID,
client_secret=ENV.CLIENT_SECRET,
refresh_token=ENV.REFRESH_TOKEN,
)
)
# Get and print a list of active webhooks
await s.get_active_webhooks()
# Get and print a list of available webhook events
await s.get_available_webhook_events()
# Unsubscribe from a specific webhook and print the result
await s.unsubscribe_webhook(url="https://webhook.site/2453453-123n7bad6va123")
asyncio.run(main())
License
MIT © 9AI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file salla-python-sdk-0.1.2.tar.gz
.
File metadata
- Download URL: salla-python-sdk-0.1.2.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05407fc9b47b3a1b0295854bcefa2a2828da2c850ccda95a1d775ebd1da08613 |
|
MD5 | 2e3d31585f64bf8472e36274d19f9d72 |
|
BLAKE2b-256 | d30db88dc55ee1dd8e2c931d2da7b0d0424e0d786ac886ae807e9bc919526ea7 |