Skip to content

uw-it-aca/uw-restclients-pws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST client for the UW Person Web Service

Build Status Coverage Status PyPi Version Python versions

Installation:

pip install UW-RestClients-PWS

To use this client, you'll need these settings in your application or script:

# Specifies whether requests should use live or mocked resources,
# acceptable values are 'Live' or 'Mock' (default)
RESTCLIENTS_PWS_DAO_CLASS='Live'

# Paths to UWCA cert and key files
RESTCLIENTS_PWS_CERT_FILE='/path/to/cert'
RESTCLIENTS_PWS_KEY_FILE='/path/to/key'

# Person Web Service hostname (eval or production)
RESTCLIENTS_PWS_HOST='https://ws.admin.washington.edu'

Optional settings:

# Customizable parameters for urllib3
RESTCLIENTS_PWS_TIMEOUT=5
RESTCLIENTS_PWS_POOL_SIZE=10

How to use this client:

from commonconf.backends import use_configparser_backend                        
from commonconf import settings
from uw_pws import PWS
import os


if __name__ == '__main__':
    settings_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                 'settings.cfg')
    use_configparser_backend(settings_path, 'PWS')
    
    client = PWS()
    person1 = client.get_person_by_netid('javerage')
    person2 = client.get_person_by_regid('12345678901234567890123456789012')
    person3 = client.get_person_by_student_number('1234567')