A Python API for the Middlebury directory.
Project description
A Python API for the Middlebury directory.
from directory import search
search(email="dsilver@middlebury.edu")
# [<Person 30972781062F9A6167A8D944F82CFD64>]
Simple Search
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>]
Advanced Search
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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for middlebury-directory-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6022d918114555e06003712ece07692e63bc21eac665b3eb465e666c315d834c |
|
MD5 | b77d67eb7409751e9a0b44eeb62a06fc |
|
BLAKE2b-256 | 3289dfef886a1dba4b2c8cd85a31105bff67aee948452788dd742fbd2b5dee23 |
Hashes for middlebury_directory-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d12a3e7389ae7ca55952ef127c06cfb8d6f36c6ca1b1a38c787b815ff44ac97 |
|
MD5 | 6fd24f18de4df3eb36d397b8ec71f71d |
|
BLAKE2b-256 | 9613d036a1d16182679d49a0b86e455220995b9c4530c1e5e2e96ec7949a9a68 |