Skip to content

Commit 99ad308

Browse files
committed
docs: add public RSC example to docstring
1 parent 4f56302 commit 99ad308

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

pins/constructors.py

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,18 @@ def board_github(
289289
)
290290

291291

292-
def board_urls(path: str, pin_paths: dict, cache=DEFAULT, allow_pickle_read=None):
292+
def board_urls(*args, **kwargs):
293+
"""DEPRECATED: This board has been renamed to board_url."""
294+
from .utils import warn_deprecated
295+
296+
warn_deprecated(
297+
"board_urls has been renamed to board_url. Please use board_url instead."
298+
)
299+
300+
return board_url(*args, **kwargs)
301+
302+
303+
def board_url(path: str, pin_paths: dict, cache=DEFAULT, allow_pickle_read=None):
293304
"""Create a board from individual urls.
294305
295306
Parameters
@@ -309,7 +320,7 @@ def board_urls(path: str, pin_paths: dict, cache=DEFAULT, allow_pickle_read=None
309320
... "df_csv": "df_csv/20220214T163720Z-9bfad/",
310321
... "df_arrow": "df_arrow/20220214T163720Z-ad0c1/",
311322
... }
312-
>>> board = board_urls(github_raw, pin_paths)
323+
>>> board = board_url(github_raw, pin_paths)
313324
>>> board.pin_list()
314325
['df_csv', 'df_arrow']
315326
"""
@@ -350,6 +361,31 @@ def board_rsconnect(
350361
CONNECT_API_KEY environment variable.
351362
**kwargs:
352363
Passed to the pins.board function.
364+
365+
Examples
366+
--------
367+
Use a server url or set the CONNECT_SERVER environt variable to connect:
368+
369+
```python
370+
server_url = "https://connect.rstudioservices.com"
371+
board = board_rsconnect(server_url)
372+
```
373+
374+
In order to read a public pin, use board_manual with the public pin url.
375+
376+
```python
377+
# for a pin at https://connect.rstudioservices.com/content/3004/
378+
board = board_url(
379+
"https://connect.rstudioservices.com/content",
380+
{"my_df": "3004/"}
381+
)
382+
board.pin_read("my_df")
383+
```
384+
385+
See Also
386+
--------
387+
board_url : board for connecting to individual pins, using a url or path.
388+
353389
"""
354390

355391
# TODO: api_key can be passed in to underlying RscApi, equiv to R's manual mode

0 commit comments

Comments
 (0)