token passthrough + bugfix #468
GitHub Actions / Black
failed
Feb 16, 2024 in 0s
5 errors
Black found 5 errors
Annotations
github-actions / Black
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/config.py#L19-L26
ingest_url: str = Field(description="URL of ingest API")
raster_url: str = Field(description="URL of raster API")
stac_url: str = Field(description="URL of STAC API")
mwaa_env: str = Field(description="MWAA URL")
- class Config():
+ class Config:
env_file = ".env"
github-actions / Black
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/auth.py#L63-L76
def get_username(claims: security.HTTPBasicCredentials = Depends(decode_token)):
return claims["sub"]
-def get_and_validate_token(token: security.HTTPAuthorizationCredentials = Depends(token_scheme)):
+
+def get_and_validate_token(
+ token: security.HTTPAuthorizationCredentials = Depends(token_scheme),
+):
decode_token(token)
return token
+
def _get_secret_hash(username: str, client_id: str, client_secret: str) -> str:
# A keyed-hash message authentication code (HMAC) calculated using
# the secret key of a user pool client and username plus the client
# ID in the message.
github-actions / Black
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/main.py#L62-L73
@workflows_app.post(
"/dataset/publish", tags=["Dataset"], dependencies=[Depends(auth.get_username)]
)
async def publish_dataset(
- token = Depends(auth.get_and_validate_token),
+ token=Depends(auth.get_and_validate_token),
dataset: Union[schemas.ZarrDataset, schemas.COGDataset] = Body(
..., discriminator="data_type"
),
):
# Construct and load collection
github-actions / Black
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/collection_publisher.py#L25-L42
collection = collection.model_dump(by_alias=True)
url = f"{ingest_api}/collections"
headers = {
"Authorization": f"Bearer {token}",
- "Content-Type": "application/json"
+ "Content-Type": "application/json",
}
response = requests.post(url, json=collection, headers=headers)
if response.status_code == 200:
print("Success:", response.json())
else:
print("Error:", response.status_code, response.text)
+
# TODO refactor
class Publisher:
common_fields = [
"title",
github-actions / Black
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/collection_publisher.py#L164-L177
collection = collection.model_dump(by_alias=True)
url = f"{ingest_api}/collections"
headers = {
"Authorization": f"Bearer {token}",
- "Content-Type": "application/json"
+ "Content-Type": "application/json",
}
response = requests.post(url, json=collection, headers=headers)
if response.status_code == 200:
print("Success:", response.json())
else:
print("Error:", response.status_code, response.text)
-
Loading