Giter Club home page Giter Club logo

python-sdk's Introduction


Frontegg Logo

Frontegg Python Client

Frontegg is a web platform where SaaS companies can set up their fully managed, scalable and brand aware - SaaS features and integrate them into their SaaS portals in up to 5 lines of code.

Report Bug · Request Feature

Table of Contents


Breaking Changes

  • As of version 2.0.0 , we will no longer provide proxy middlewares.

  • As of version 3.0.0, Python 3.7 is no longer supported.


Installation

Frontegg python sdk is available as pypi package.

Before installing make sure that your app using python 3.

pip install frontegg  

Singing Up To Frontegg

Before you can start with frontegg, please make sure to sign up in order to get your free account.

After you signed up, you will be able to get your client ID and API key here.

Supported Liberies

Frontegg Slack SDK support the following frameworks:

If you could not find the library you are looking for here, please contact us and let us know :)

Debugging

Frontegg use the python 3 built in loggin libary to log useful debugging information.

In order to had those logs you can add the environment variable "FRONTEGG_DEBUG":

FRONTEGG_DEBUG=True  

Or configure it in the app itself:

from frontegg import frontegg_logger  
import logging  
  
frontegg_logger.setLevel(logging.DEBUG)  

python-sdk's People

Contributors

amirjaron avatar amitripshtos avatar aviadmizrachi avatar benesch avatar dependabot[bot] avatar eldad-frontegg avatar eran-frontegg avatar guy-frontegg avatar guy7b avatar hxyannay avatar ihigani avatar levpachmanov avatar mattotodd avatar omers-frontegg avatar rafi-rr avatar tomergrinbergfe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-sdk's Issues

Removal of logging handlers and formatting

Hey!
Currently, the Frontegg Python package is writing logs to the "Frontegg" logger, and in addition you specify the format and handler.

However, doing so in a package causes lack of control of the loggers, I can't use my own logger.
The best practice around this area is not to specify logging handler or format, just use getLogger and that's it. The user of this package should specify the logging format and handler.

I think a good change is to have logger.py be:

import logging
logger = logging.getLogger('Frontegg')

And for your own tests you can just set the logger settings.

Thanks,
Amit.

Loosen package requirements incl cryptography

Hi,

Could you consider loosening your dependancies unless there are technical reasons to do so? For example right now cryptography v42 cannot be installed alongside frontegg v3.0.0. Instead of specifying^41.0 could you set a minimum version or just * if that works?

[BUG] TypeError: 'bool' object is not callable

python3.11/site-packages/frontegg/flask/frontegg.py", line 18, in should_refresh_vendor_token
    return self.authenticator.should_refresh_vendor_token()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'bool' object is not callable

[BUG] The frontegg package requires Flask, even if you use FastAPI.

Hey,
Because of import issue, in order to make this package work - we must install Flask as well (while we don't need it).

That’s because the file _mixins.py which has the following import:
from flask import request
So when using frontegg package, it calls init.py file which imports the _mixins.py file and if flask is not installed it wil raise an exception.
You can the see the following stacktrace:

Traceback (most recent call last):
  File "/Users/noam/PycharmProjects/runtime/backend/main.py", line 9, in <module>
    from frontegg.fastapi import frontegg
  File "/Users/noam/PycharmProjects/venvs/runtime/lib/python3.8/site-packages/frontegg/__init__.py", line 2, in <module>
    from frontegg.client import FronteggRESTClient, FronteggClient, FronteggContext
  File "/Users/noam/PycharmProjects/venvs/runtime/lib/python3.8/site-packages/frontegg/client.py", line 10, in <module>
    from frontegg._mixins import AuditsClientMixin, SSOClientMixin
  File "/Users/noam/PycharmProjects/venvs/runtime/lib/python3.8/site-packages/frontegg/_mixins.py", line 5, in <module>
    from flask import request
ModuleNotFoundError: No module named 'flask'

The solution is only use the “flask” package under the “flask” folder, and don’t call the flask/fastapi folder modules in the main package init file
You can reproduce the issue if you install the following pages: fastapi, frontegg and use your example code (in an isolated environment without flask)

Thanks

Django support

Is it possible somehow to implement integration with django?

Had to shift the frontegg.init_app inside lifespan function for FastAPI

After an upgrade to Frontegg version 3.0.0 my authentication calls started failing.

So I came to this repo and changed my fastapi app startup using a startup_event function. But that didn't work either.

FastAPI version 0.92.0

I had to instead add it to a lifespan function as follows:

@asynccontextmanager
async def lifespan(app: FastAPI):
    """
    This function is used to run a task in the background for the entire lifespan of the application.
    
    Args:
        app (FastAPI): FastAPI application instance
    
    frontend.init_app() is used to initialize the Frontegg SDK.
    """
    print("Starting lifespan...")
    await frontegg.init_app(client_id=FRONTEGG_CLIENT_ID, api_key=FRONTEGG_API_KEY)
    try:
        yield
    finally:
        print("Stopping lifespan...")

app = FastAPI(debug=True, lifespan=lifespan)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.