Skip to content

Commit c21e127

Browse files
Readme added for getting partner cient for offline token.
1 parent ebc4314 commit c21e127

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ async def background_handler(request):
9494
return response.json({"error_message": str(e)}, 500)
9595
```
9696

97+
#### How to call partner apis in background tasks?
98+
99+
Background tasks running under some consumer or webhook or under any queue can get partner client via method `get_partner_client`. It will return instance of `PartnerClient` as well.
100+
101+
> Here FdkClient `access_mode` should be **offline**. Cause such client can only access PlatformClient in background task.
102+
103+
```python
104+
async def background_handler(request):
105+
try:
106+
organization_id = request.args.get("organizationId")
107+
client = await fdk_extension_client.get_partner_client(organization_id)
108+
return response.json({"success": True})
109+
except Exception as e:
110+
return response.json({"error_message": str(e)}, 500)
111+
```
112+
97113
#### How to call partner apis?
98114

99115
To call partner api you need to have instance of `PartnerClient`. Instance holds methods for SDK classes. All routes registered under `partner_api_routes` blueprint will have `partner_client` under request context object which is instance of `PartnerClient`.

0 commit comments

Comments
 (0)