angely-dev / freeradius-api Goto Github PK
View Code? Open in Web Editor NEWA Python REST API on top of the FreeRADIUS database schema for automation and integration purposes
License: MIT License
A Python REST API on top of the FreeRADIUS database schema for automation and integration purposes
License: MIT License
i changed the API url parameters to my host Ip and the code runs okay, but cant access on browser
Looking at the code (https://github.com/angely-dev/freeradius-api/blob/master/src/api.py#L9), the lack of support for updating entities is intentionally, and it's recommended to remove and re-create entities when an update is needed.
However, this is problematic for the use case where you want to update a group that already has users attached. I would like to update this group to add some more replies, but removing this isn't possible without removing the group (and links to the users). Also, since this isn't possible in one atomic operation, the users will be unlinked to a group for a brief moment.
I'm thinking on adding this functionality, but will be this be accepted in this project, or is this beyond the scope of this project?
Pydantic recently released the v2 major version which breaks or deprecates some features of the v1. A migration guide has been published:
@root_validator
is deprecated and should be replaced with @model_validator
schema_extra
โ json_schema_extra
Some endpoints currently fetch and return all results without pagination. This could lead to performance issues.
In the era of infinite scrolling, the keyset pagination mechanism is generally preferred over the offset pagination mechanism. Work has started in 460de53 in that sense.
find_usernames()
, find_groupnames()
and find_nasnames()
methods in place of find_all_usernames()
, find_all_groupnames()
and find_all_nasnames()
methods still there for legacy purposes.Link
header as per RFC 5988 (this is what GitHub does actually).Some endpoints trigger HTTP errors (e.g., 404
). Except for the 422
(internal RequestValidationError
), HTTP errors are not yet specified per endpoint. FastAPI allows it through the additional-responses feature:
class Message(BaseModel):
message: str
@app.get("/items/{item_id}", response_model=Item, responses={404: {"model": Message}})
async def read_item(item_id: str):
if item_id == "foo":
return {"id": "foo", "value": "there goes my hero"}
return JSONResponse(status_code=404, content={"message": "Item not found"})
FastAPI allows for endpoints example data using Pydantic schema customization. This is handy for testing the API. Prepare example data for:
User
base modelGroup
base modelNas
base modelFirst of all, I don't want to force this project into a direction you don't want to. Feel free to reject my comments and remarks :)
This project has a good functionality, but it's lacking options to configure it without having to edit the files. My goal is to have an application (probably packaged in a docker image) that can be configured and started with all database drivers included.
I'm looking at https://fastapi.tiangolo.com/advanced/settings/ to parse environment variables (and probably also command line variables now that pydantic/pydantic-settings#214 has been merged, a few days ago!), so the hardcoded configurations like the db_connection
parameters, or the RadTables
overrides can be removed and filled in from configuration.
I've started working on this, but if you don't like this direction, feel free to say so, and I'll setup a fork of this project with these changes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.