Skip to content

Commit

Permalink
Formated with black
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Sunglasses committed Oct 10, 2023
1 parent 1b1ac1f commit 99e120c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 22 deletions.
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ repos:
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
hooks:
- id: ruff
- repo: https://github.com/dhruvmanila/remove-print-statements
rev: v0.5.2
hooks:
Expand Down
19 changes: 12 additions & 7 deletions bloom/api/router/auth/auth_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,30 @@

@router.get("/github-login")
async def github_auth(settings: Annotated[Config, Depends(get_settings)]):
return RedirectResponse(f"https://github.com/login/oauth/authorize?client_id={settings.GITHUB_CLIENT_ID}", status_code=status.HTTP_302_FOUND)
return RedirectResponse(
f"https://github.com/login/oauth/authorize?client_id={settings.GITHUB_CLIENT_ID}",
status_code=status.HTTP_302_FOUND,
)


@router.get("/github-code")
async def github_code(code: str, settings: Annotated[Config, Depends(get_settings)]):
params: Dict[str, str] = {
"client_id": settings.GITHUB_CLIENT_ID,
"client_secret": settings.GITHUB_CLIENT_SECRET,
"code": code
"code": code,
}

headers: Dict[str, str] = {
"Accept": "application/json"
}
headers: Dict[str, str] = {"Accept": "application/json"}
async with httpx.AsyncClient() as client:
response = await client.post(url="https://github.com/login/oauth/access_token", params=params, headers=headers)
response = await client.post(
url="https://github.com/login/oauth/access_token",
params=params,
headers=headers,
)

response_json = response.json()
access_token = response_json['access_token']
access_token = response_json["access_token"]

async with httpx.AsyncClient() as client:
headers.update({"Authorization": f"Bearer {access_token}"})
Expand Down
5 changes: 1 addition & 4 deletions bloom/api/router/auth/auth_router.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from fastapi import APIRouter, Depends

router = APIRouter(
prefix="/bloom/v1/auth",
tags=["auth"]
)
router = APIRouter(prefix="/bloom/v1/auth", tags=["auth"])
5 changes: 1 addition & 4 deletions bloom/api/router/status/status_router.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from fastapi import APIRouter, status
from typing import Annotated

router = APIRouter(
prefix="/bloom/v1/status",
tags=["status"]
)
router = APIRouter(prefix="/bloom/v1/status", tags=["status"])


@router.get("", status_code=status.HTTP_200_OK)
Expand Down
4 changes: 1 addition & 3 deletions bloom/db/repositories/database_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
from ...core.settings import config

engine = create_engine(
config.get_settings().SQLALCHEMY_DATABASE_URI,
connect_args={},
future=True
config.get_settings().SQLALCHEMY_DATABASE_URI, connect_args={}, future=True
)

SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Expand Down
1 change: 1 addition & 0 deletions bloom/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from logging.config import dictConfig
from .models.domain.users_model import Base
from .db.repositories.database_setup import engine

dictConfig(LogConfig())

Base.metadata.create_all(bind=engine)
Expand Down

0 comments on commit 99e120c

Please sign in to comment.