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
- Author - Tsiresy Mila
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nestipy_socialite-0.1.2.tar.gz | 6.6 kB | Without provenance | Details for nestipy_socialite-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nestipy_socialite-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for nestipy_socialite-0.1.2-py3-none-any.whl |
Total release size: 17.2 kB
Security for nestipy-socialite 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.