Metadata-Version: 2.1
Name: salla-python-sdk
Version: 0.1.2
Summary: A python SDK for salla integration
Home-page: https://github.com/9ai-in/salla-python-sdk/
Author: 9AI
Author-email: team@9ai.in
License: MIT
Keywords: salla,salla-sdk,salla-api,salla-python
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Requires-Python: ~=3.10
Description-Content-Type: text/markdown
Provides-Extra: dev

<h2 align='center'>Salla SDK ðŸ“¦</h2>
<p align="center">
<a href="https://github.com/9ai-in"><img title="Author" src="https://img.shields.io/badge/Author-9AI--in-black.svg?style=for-the-badge&logo=github"></a>
<p align="center">
<a href="https://github.com/9ai-in/salla-python-sdk/stargazers/"><img title="Stars" src="https://img.shields.io/github/stars/9ai-in/salla-python-sdk?color=black&style=flat-square"></a>
<a href="https://github.com/9ai-in/salla-python-sdk/network/members"><img title="Forks" src="https://img.shields.io/github/forks/9ai-in/salla-python-sdk?color=black&style=flat-square"></a>
</p>


# Installation

```python
$ 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

```python

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](https://github.com/9AI-IN)

