Skip to main content

Nestipy Logo

Version Python License

Description

Nestipy is a Python framework built on top of FastAPI that follows the modular architecture of NestJS

Under the hood, Nestipy makes use of FastAPI, but also provides compatibility with a wide range of other libraries, like Blacksheep, allowing for easy use of the myriad of third-party plugins which are available.

Getting started

    pip install nestipy-socialite

app_module.py

import os

from dotenv import load_dotenv
from nestipy.common import Module

from app_controller import AppController
from app_service import AppService
from nestipy_socialite import SocialiteModule, SocialiteConfig
from nestipy_socialite import GoogleOAuthProvider, FacebookOAuthProvider

load_dotenv()


@Module(
    imports=[
        SocialiteModule.register(
            SocialiteConfig(
                providers={
                    "google": GoogleOAuthProvider(
                        client_id=os.environ.get("GOOGLE_CLIENT_ID"),
                        client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"),
                        redirect_uri=os.environ.get("GOOGLE_REDIRECT_URI")
                    ),
                    "facebook": FacebookOAuthProvider(
                        client_id=os.environ.get("FACEBOOK_CLIENT_ID"),
                        client_secret=os.environ.get("FACEBOOK_CLIENT_SECRET"),
                        redirect_uri=os.environ.get("FACEBOOK_REDIRECT_URI")
                    )
                }
            )
        )
    ],
    controllers=[AppController],
    providers=[AppService]
)
class AppModule:
    ...

app_controller.py

from typing import Annotated

from nestipy.common import Controller, Get, Post, Response, Request
from nestipy.ioc import Inject, Param, Res, Req

from nestipy_socialite import SocialiteService


@Controller('auth')
class AppController:
    socialite: Annotated[SocialiteService, Inject()]

    @Get('/{driver}/login')
    async def get(self, driver: Annotated[str, Param('driver')], res: Annotated[Response, Res()]) -> Response:
        redirect_url = self.socialite.driver(driver).get_authorization_url()
        print(redirect_url)
        return await res.redirect(redirect_url)

    @Get('/{driver}/callback')
    async def callback(
            self,
            req: Annotated[Request, Req()],
            res: Annotated[Response, Res()],
            driver: Annotated[str, Param('driver')],
    ) -> dict:
        code = req.query_params.get('code')
        return self.socialite.driver(driver).user(code=code)

Support

Nestipy is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. If you'd like to join them, please [read more here].

Stay in touch

License

Nestipy is MIT licensed.

Metadata

Release files for nestipy-socialite 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nestipy-socialite 0.1.2
File Size Uploaded
nestipy_socialite-0.1.2.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nestipy-socialite 0.1.2
File Interpreter ABI Platform
nestipy_socialite-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / nestipy_socialite-0.1.2.tar.gz

Download URL nestipy_socialite-0.1.2.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3bf4ea23109fded3342bcadbf89c35ad2cd401d1396a7062b1fa29f84f468c05
BLAKE2b-256 checksum
How to use checksums
db54fb69f1b535506f162a51a1f564d80b6eaf875a6a50105a6c129bd7a64a03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.13.0 Darwin/23.4.0

Release files / nestipy_socialite-0.1.2-py3-none-any.whl

Download URL nestipy_socialite-0.1.2-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cbf23f61e0435f90695641d7943313e6a909142df62a7d32bb1a39006c4f5ac
BLAKE2b-256 checksum
How to use checksums
f504cb5234a12060adaf4d4f1c39cd4f1f7864c211c2d35a51d5c1bf0894c220
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.13.0 Darwin/23.4.0

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page