Simplify reading Connect pins as the viewer

未關閉
#363 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
python
領域
backend

研究方向

Start with the visitor example in docs/index.qmd and review the existing Client.with_user_session_token() behavior described in the issue. The work also depends on adding a helper to posit-sdk and deciding whether board_connect() should accept a visitor client or session directly. Done when the helper and example are updated and the API design choice is resolved.

由索引模型根據 Issue 內容生成。

描述

.enhancement

#362 documents how to read pins as the viewer on Posit Connect with a visitor API key. The example must read the Posit-Connect-User-Session-Token header from the Shiny session and exchange it with posit-sdk:

token = session.http_conn.headers.get("Posit-Connect-User-Session-Token")
client = connect.Client()
credentials = client.oauth.get_credentials(
    token,
    requested_token_type="urn:posit:connect:api-key",
)
board = board_connect(server_url=..., api_key=credentials["access_token"], cache=None)

Users must know about the header, the token exchange, and the token type, and it is easy to get wrong. Client.with_user_session_token() already does the exchange, but it does not expose the API key that pins needs.

In the review of the matching pins-r docs (rstudio/pins-r#906), a helper was proposed, so that the example does not need to explain the header or the exchange.

Tasks:

  • Add a helper to posit-sdk that takes a Shiny session and returns the visitor API key, or a client that exposes it.
  • Update the visitor example in docs/index.qmd to use the helper.
  • Decide if board_connect() should accept the visitor client or session directly, so that users do not pass the key and cache by hand.
主要語言
Python
星號
59
分支
11
PR 合併指標
30 天內沒有已合併 PR

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

rstudio/pins-python 的其他 Issue

查看 rstudio/pins-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。