Skip to content

Commit cedc48d

Browse files
chore(docs): use environment variables for authentication in code snippets
1 parent 18c7c0f commit cedc48d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,15 @@ pip install perplexityai[aiohttp]
116116
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
117117

118118
```python
119+
import os
119120
import asyncio
120121
from perplexity import DefaultAioHttpClient
121122
from perplexity import AsyncPerplexity
122123

123124

124125
async def main() -> None:
125126
async with AsyncPerplexity(
126-
api_key="My API Key",
127+
api_key=os.environ.get("PERPLEXITY_API_KEY"), # This is the default and can be omitted
127128
http_client=DefaultAioHttpClient(),
128129
) as client:
129130
stream_chunk = await client.chat.completions.create(

0 commit comments

Comments
 (0)