facultyai / facultyai/faculty

Token caching with custom profiles

Offen
#105 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
16
Forks
5
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Token caching is implemented in `faculty.session.get_session`. But this calls `faculty.config.resolve_profile` which has a pre-defined order of places it pulls credentials from. It would be better if `faculty.session.get_session` takes in a `faculty.config.Profile` instance (or caching is implemented without having to always force resolving profiles). For example, on a platform server that has environmental variables defined, passing `credentials_path` to `faculty.session.get_session` has no effect.

Note that for my example there is a somewhat ugly workaround:

```
import faculty
import faculty.session
import faculty.clients

profile = faculty.config.load_profile('/path/to/config', 'default')
session = faculty.session.get_session(
domain=profile.domain, client_id=profile.client_id,
client_secret=profile.client_secret
)
client_class = faculty.clients.for_resource('cluster')
cluster = client_class(session)
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.