-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.py
More file actions
62 lines (49 loc) · 1.66 KB
/
example.py
File metadata and controls
62 lines (49 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import asyncio
from salla import (
ENV,
Refresh_Token_Payload,
Salla,
Webhook_Events,
WebhookPayload,
Access_Token_Payload,
)
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")
await s.generate_access_token_from_code(
payload=Access_Token_Payload(
client_id=ENV.CLIENT_ID,
client_secret=ENV.CLIENT_SECRET,
code="anabashdghgasdh",
redirect_uri="https://9ai.in"
#! Redirection URI should be same which was mentioned in the salla App [Custome mode]
)
)
asyncio.run(main())