GeorepositoryCredential¶
- class geodetic_engine.georepository.GeorepositoryCredential[source]¶
Bases:
objectFetches and caches an OAuth2 access token.
The token is requested with the client credentials grant, authenticating with HTTP Basic as required by the identity server, and reused until it is within the renewal skew of expiring.
Example
>>> credential = GeorepositoryCredential( ... token_url="https://georepo.example.com/auth/connect/token", ... client_id="...", ... client_secret="...", ... scope="GeoRepositoryAPI_Scope", ... ) >>> credential.authorization_header() {'Authorization': 'Bearer ...'}
- authorization_header()[source]¶
Return an
Authorizationheader, refreshing the token if needed.- Return type:
- Returns:
A single-entry mapping suitable for merging into request headers.
- Raises:
GeorepositoryAuthError – If a token cannot be obtained.