Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions pins/constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,23 @@ def board_connect(

Examples
--------
Use a server URL or set the `CONNECT_SERVER` environt variable to connect:
Pins will automatically look for the `CONNECT_SERVER` and `CONNECT_API_KEY` environment variables:

```python
server_url = "https://connect.rstudioservices.com"
board = board_connect(server_url)
# where environment vars CONNECT_SERVER and CONNECT_API_KEY are set
board = board_connect()
```

Or use the `[dotenv](https://saurabh-kumar.com/python-dotenv/)` package to load other environment variable names from a `.env` file:

```python
import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())

api_key = os.getenv("MY_API_KEY")
server_url = os.getenv("MY_CONNECT_URL")
board = board_connect(server_url=server_url, api_key=api_key)
```

In order to read a public pin, use `board_url()` with the public pin URL:
Expand Down
3 changes: 1 addition & 2 deletions pins/tests/test_boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,8 @@ def test_board_rsc_pin_read_public(df, board_short):


def test_board_manual_http_file_download():
# TODO: change when repo is moved to RStudio

path = "https://raw.githubusercontent.com/machow/pins-python"
path = "https://raw.githubusercontent.com/rstudio/pins-python"
license_path = "main/LICENSE"

# use a simple cache, which automatically creates a temporary directory
Expand Down