Skip to content

coursereviews/directory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Middlebury Directory

image

A Python API for the Middlebury directory.

from directory import search

search(email="dsilver@middlebury.edu")
# [<Person 30972781062F9A6167A8D944F82CFD64>]

Install

$ pip install middlebury-directory

Perform a simple keyword search.

from directory import search

search("Dana Silver")
# [<Person 30972781062F9A6167A8D944F82CFD64>]

This is equivalent passing the query keyword argument:

from directory import search

search(query="Dana Silver")
# [<Person 30972781062F9A6167A8D944F82CFD64>]

Perform an advanced search with some or all of the available search fields: first_name, last_name, email, phone, address, location, job_title, person_type, department.

You can't perform a simple search and an advanced search in the same query. Setting query and any of the other fields will fail validation.

from directory import search

search(email="dsilver@middlebury.edu")
# [<Person 30972781062F9A6167A8D944F82CFD64>]
from directory import search

search(first_name="Dana", person_type="Faculty")
# [<Person 90338E439DA4652A2BDE2AC3F327A563>]

Advanced Usage

For raw access to validation and search fields, and control over when the HTTP requests are sent, use the Search class. The Search class can be initialized with any of the arguments to the search method.

from directory import Search

# Construct a search object
query = Search('Dana Silver')

# Validate the search
query.validate()

# Get the search fields (makes an HTTP request for form parameters)
query.search_fields()

# Get the search results (makes HTTP requests for the search results)
query.results()

About

A Python API for the Middlebury directory.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages