Skip to content

Commit

Permalink
Merge pull request #58 from ChrisMandich/master
Browse files Browse the repository at this point in the history
Add Support for UDMP, CSRF POSTS, and Radius
  • Loading branch information
finish06 authored Sep 14, 2020
2 parents cbb9164 + a509a53 commit d4145b1
Show file tree
Hide file tree
Showing 9 changed files with 648 additions and 199 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Support for UDMP

### Fixed
- Support for CSRF

## [2.20.1] - 2020-03-30
### Fixed
- Lint failures in controller.py

## [2.20.0] - 2020-03-30
### Added
- CHANGELOG
- Added support for UnifiOS: `version = 'unifiOS'`

## [2.19.0] - 2019-10-28
### Added
Expand Down
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Create a Controller object.
- `username` -- the username to log in with
- `password` -- the password to log in with
- `port` -- the port of the controller host
- `version` -- the base version of the controller API [v4|v5]
- `version` -- the base version of the controller API [v4|v5|unifiOS|UDMP-unifiOS]
- `site_id` -- the site ID to access
- `ssl_verify` -- Verify the controllers SSL certificate, default=True, can also be False or "path/to/custom_cert.pem"

Expand Down Expand Up @@ -208,6 +208,29 @@ Gets the current state & configuration of the given device based on its MAC Addr

- `target_mac` -- MAC address of the device

### `get_radius_users(self)`
Returns a list of all RADIUS users, name, password, 24 digit user id, and 24 digit site id.

### `add_radius_user(self, name, password)`
Add a new RADIUS user with this username and password.

- `name` -- the new user's username
- `password` -- the new user's password

### `update_radius_user(self, name, password, id)`
Update a RADIUS user to this new username and password.
Requires the user's 24 digit user id, which can be gotten from `get_radius_users(self)`.

- `name` -- the user's new username
- `password` -- the user's new password
- `id` -- the user's 24 digit user id.

### `delete_radius_user(self, id)`
Delete a RADIUS user.
Requires the user's 24 digit user id, which can be gotten from `get_radius_users(self)`.

- `id` -- the user's 24 digit user id.

### `get_switch_port_overrides(self, target_mac)`
Gets a list of port overrides, in dictionary format, for the given target MAC address. The dictionary contains the port_idx, portconf_id, poe_mode, & name.

Expand All @@ -232,8 +255,17 @@ The following small utilities are bundled with the API:

### unifi-ls-clients

Lists the currently active clients on the networks. Takes parameters for
controller, username, password, controller version and site ID (UniFi >= 3.x)
Lists the currently active clients on the networks. Can take the following parameters:
|Parameters |Description |Default |
| ------------- |---------------------------------------| -------|
| -c | controller address |unifi |
| -u | controller username |admin |
| -p | controller password | |
| -b | controller port |8443 |
| -v | controller base version |v5 |
| -s | site ID, UniFi >=3.x only |default |
| -V | ignore SSL certificates | |
| -C | verify with ssl certificate pem file | |

```
jb@unifi:~ % unifi-ls-clients -c localhost -u admin -p p4ssw0rd -v v3 -s default
Expand Down
8 changes: 6 additions & 2 deletions pyunifi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
"""
Python __init__ to interact with UniFi Controller
"""
import urllib3


def http_debug_log_stderr():
"""Dump requests urllib3 debug messages to stderr"""
import requests
requests.packages.urllib3.add_stderr_logger()
urllib3.add_stderr_logger()
Loading

0 comments on commit d4145b1

Please sign in to comment.