-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] Add refresh token in Onisep API. (#20)
fix: Implement refresh token for oniseop API
- Loading branch information
1 parent
aae075c
commit 01659ec
Showing
3 changed files
with
34 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
from enum import Enum | ||
import os | ||
|
||
from src.business_logic.formation.scrap.utils.get_onisep_token import get_token | ||
from src.business_logic.formation.scrap.utils.get_onisep_token import ( | ||
BearerToken, | ||
get_token, | ||
) | ||
|
||
|
||
class HeaderKey(Enum): | ||
APPLICATION_ID = "Application-ID" | ||
AUTHORIZATION = "Authorization" | ||
|
||
|
||
ONISEP_URL = "https://api.opendata.onisep.fr/api/1.0/dataset/" | ||
|
||
HEADERS = { | ||
"Application-ID": os.environ.get("ONISEP_APP_ID"), | ||
"Authorization": "Bearer " + get_token(), | ||
HEADERS: dict[HeaderKey, BearerToken | str] = { | ||
HeaderKey.APPLICATION_ID.value: os.environ.get("ONISEP_APP_ID"), | ||
HeaderKey.AUTHORIZATION.value: get_token(), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters