Simplify reading Connect pins as the viewer

Aperta
#363 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

.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.
Lingua principale
Python
Stelle
59
Fork
11
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rstudio/pins-python

Tutte le issue di rstudio/pins-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.