Skip to content

Commit bb5f6b8

Browse files
Merge branch 'asyncio' of github.com:mykola-mokhnach-parloa/unleash-python-sdk into asyncio
2 parents 3a5342b + 8200b0a commit bb5f6b8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/usage.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ Initialization
3434
3535
import asyncio
3636
from UnleashClient.asynchronous import AsyncUnleashClient
37-
37+
3838
async def main():
3939
client = AsyncUnleashClient("https://unleash.herokuapp.com/api", "My Program")
4040
await client.initialize_client()
41-
41+
4242
# Your code here
43-
43+
4444
await client.destroy()
45-
45+
4646
asyncio.run(main())
4747
4848
You can also use the async client as a context manager:
@@ -51,12 +51,12 @@ You can also use the async client as a context manager:
5151
5252
import asyncio
5353
from UnleashClient.asynchronous import AsyncUnleashClient
54-
54+
5555
async def main():
5656
async with AsyncUnleashClient("https://unleash.herokuapp.com/api", "My Program") as client:
5757
# Client is automatically initialized and cleaned up
5858
is_enabled = client.is_enabled("my_toggle")
59-
59+
6060
asyncio.run(main())
6161
6262
Checking if a feature is enabled
@@ -160,13 +160,13 @@ Note that these methods are **not** async - only the initialization and cleanup
160160
161161
import asyncio
162162
from UnleashClient.asynchronous import AsyncUnleashClient
163-
163+
164164
async def main():
165165
async with AsyncUnleashClient("https://unleash.herokuapp.com/api", "My Program") as client:
166166
# These are synchronous calls
167167
is_enabled = client.is_enabled("my_toggle")
168168
variant = client.get_variant("variant_toggle", {"userId": "123"})
169-
169+
170170
asyncio.run(main())
171171
172172
Using ``UnleashClient`` with Gitlab
@@ -191,7 +191,7 @@ For async:
191191
.. code-block:: python
192192
193193
from UnleashClient.asynchronous import AsyncUnleashClient
194-
194+
195195
async def main():
196196
async with AsyncUnleashClient(
197197
url="https://gitlab.com/api/v4/feature_flags/someproject/someid",
@@ -201,5 +201,5 @@ For async:
201201
disable_registration=True
202202
) as client:
203203
is_enabled = client.is_enabled("my_toggle")
204-
204+
205205
asyncio.run(main())

0 commit comments

Comments
 (0)