d7ff0be1aa8fd4291f1c533a567c4871a097ce66
Introduction
pyrad3 is an implementation of a RADIUS client/server as described in RFC2865. It takes care of all the details like building RADIUS packets, sending them and decoding responses.
This is the successor of pyrad. It is written in python3 only (python3.6+) and has an improved API.
Here is an example of doing a authentication request:
from pyrad.client import Client
from pyrad.dictionary import Dictionary
import pyrad.packet
srv = Client(server="localhost", secret=b"Kah3choteereethiejeimaeziecumi",
dict=Dictionary("dictionary"))
# create request
req = srv.CreateAuthPacket(code=pyrad.packet.AccessRequest,
User_Name="wichert", NAS_Identifier="localhost")
req["User-Password"] = req.PwCrypt("password")
# send request
reply = srv.SendPacket(req)
if reply.code == pyrad.packet.AccessAccept:
print("access accepted")
else:
print("access denied")
print("Attributes returned by server:")
for key, values in reply.items():
print("{key}: {value}")
Requirements & Installation
pyrad requires Python 3.6 or later.
# Install from the repository
pip install .
# Install from pypi
pip install pyrad3
License
pyrad3 is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE LICENSE-MIT and COPYRIGHT for details.
Description
Languages
Python
98.4%
Nix
1.6%