Skip to main content

RADIUS authentication module

Project description

Travis CI Status Code Coverage


RADIUS authentication module for Python 2.7.13+

(c) 1999 Stuart Bishop <>

This module provides basic RADIUS client capabilities, allowing your Python code to authenticate against any RFC2138 compliant RADIUS server.


$ pip install py-radius


The module can be run from the command line, providing a minimal RADIUS client to test out RADIUS servers:

$ python -m radius
Host [default: 'radius']: radius
Port [default: 1812]: 1812
Enter RADIUS Secret: s3cr3t
Enter your username: foobar
Enter your password: qux
Authentication Successful


Here is an example of using the library.

import radius

radius.authenticate(secret, username, password, host='radius', port=1812)

# - OR -

r = radius.Radius(secret, host='radius', port=1812)
print('success' if r.authenticate(username, password) else 'failure')

If your RADIUS server requires challenge/response, the usage is a bit more complex.

import radius

r = radius.Radius(secret, host='radius')

    print('success' if r.authenticate(username, password) else 'failure')
except radius.ChallengeResponse as e:

# The ChallengeResponse exception has `messages` and `state` attributes
# `messages` can be displayed to the user to prompt them for their
# challenge response. `state` must be echoed back as a RADIUS attribute.

# Send state as an attribute _IF_ provided.
attrs = {'State': e.state} if e.state else {}

# Finally authenticate again using the challenge response from the user
# in place of the password.
print('success' if r.authenticate(username, response, attributes=attrs)
                else 'failure')

This module has extensive logging, enable it using the Python logging framework.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for radius, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size radius-0.0.4-py2.py3-none-any.whl (9.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size radius-0.0.4.tar.gz (9.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page