File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -435,11 +435,23 @@ def board_connect(
435435
436436 Examples
437437 --------
438- Use a server URL or set the `CONNECT_SERVER` environt variable to connect :
438+ Pins will automatically look for the `CONNECT_SERVER` and `CONNECT_API_KEY` environment variables :
439439
440440 ```python
441- server_url = "https://connect.rstudioservices.com"
442- board = board_connect(server_url)
441+ # where environment vars CONNECT_SERVER and CONNECT_API_KEY are set
442+ board = board_connect()
443+ ```
444+
445+ Or use the `[dotenv](https://saurabh-kumar.com/python-dotenv/)` package to load other environment variable names from a `.env` file:
446+
447+ ```python
448+ import os
449+ from dotenv import load_dotenv, find_dotenv
450+ load_dotenv(find_dotenv())
451+
452+ api_key = os.getenv("MY_API_KEY")
453+ server_url = os.getenv("MY_CONNECT_URL")
454+ board = board_connect(server_url=server_url, api_key=api_key)
443455 ```
444456
445457 In order to read a public pin, use `board_url()` with the public pin URL:
You can’t perform that action at this time.
0 commit comments