From 2c9270bf098a5dea09c95b890b6a52db5199b0a8 Mon Sep 17 00:00:00 2001 From: isabelizimm Date: Mon, 4 Sep 2023 17:12:04 -0400 Subject: [PATCH 1/3] add more examples to board_connect --- pins/constructors.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pins/constructors.py b/pins/constructors.py index 9bf4d3b1..86376747 100644 --- a/pins/constructors.py +++ b/pins/constructors.py @@ -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]()` 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: From 7f9bf91880efb25c78064caa3c5cbf6e2e996338 Mon Sep 17 00:00:00 2001 From: isabelizimm Date: Fri, 22 Sep 2023 13:15:30 -0500 Subject: [PATCH 2/3] link to python-dotenv --- pins/constructors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pins/constructors.py b/pins/constructors.py index 86376747..04893cab 100644 --- a/pins/constructors.py +++ b/pins/constructors.py @@ -442,7 +442,7 @@ def board_connect( board = board_connect() ``` - Or use the `[dotenv]()` package to load other environment variable names from a `.env` file: + 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 ecf65bd18d7de412804bdc2b0699b798e41116f5 Mon Sep 17 00:00:00 2001 From: isabelizimm Date: Fri, 22 Sep 2023 16:01:05 -0500 Subject: [PATCH 3/3] update github path for breaking test --- pins/tests/test_boards.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pins/tests/test_boards.py b/pins/tests/test_boards.py index 23095e4d..e7961916 100644 --- a/pins/tests/test_boards.py +++ b/pins/tests/test_boards.py @@ -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