Skip to main content

Flexible http client for reading UW Groups API v3.

Project description

uwgs Build Status

Python3 Client Library for UW Groups API v3

Functionality

At the moment, this library provides read-only functionality for:

import uwgs
from collections import namedtuple
import os
import json

Config = namedtuple('Config', ['client_cert', 'client_key', 'url'])

def load_config():
    cwd = os.path.dirname(os.path.abspath(__file__))
    fp = os.path.join(cwd, 'uwgs.json')
    with open(fp, 'r') as f:
        data = json.load(f)
        cfg = Config(data['client_cert'], data['client_key'], data['url'])
        return cfg


def cli():
    cfg = load_config()
    client = uwgs.Client(cfg.client_cert, cfg.client_key, cfg.url)

    payload = client.search(name='<group_prefix>*')
    if payload.ok:
        groups = [group['id'] for group in payload.data['data']]
        rosters = client.get_memberships(groups)
        print(rosters)

if __name__ == "__main__":
    cli()

Project details


Download files

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

Source Distribution

uwgs-0.2.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

uwgs-0.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file uwgs-0.2.0.tar.gz.

File metadata

  • Download URL: uwgs-0.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for uwgs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b04a086b2cef6e7bf0540e375d93575c4503937dce26056bc5b92572168b37eb
MD5 2dfbda259b658bf7a5c2727834b1a844
BLAKE2b-256 db507d866e456cacf6c275fc19a3183fdfef556cb81f2383e74286ab8da2c75b

See more details on using hashes here.

File details

Details for the file uwgs-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: uwgs-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for uwgs-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37aafedfaf970d6831383570ec33283ce6d23c7cedb958e8f23e95d2acc525c8
MD5 133ce291006bbbfac368545f318e2f9d
BLAKE2b-256 f55b46e6e2d536d3b99574eb727a56b31ed5ce3b7806bea7b9c332ca45827f6c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page