EDAN python
Basic python3 module to query the Smithsonian's Enterprise Digital Asset Network (EDAN). Requires Python 3.11 or higher.
Installation
Install using pip:
pip install edan
Then, load the module in Python:
import edan
You will need an ID and key, make the request in ServiceNow: https://edandoc.si.edu/more.html#auth
metadata_search() - Search EDAN
The function metadata_search() takes these arguments:
q= Search termsfqs= Python list of filter query parameters, for example:["online_media_type:\"Images\""]- Select records with images["data_source:\"Smithsonian+Gardens\""]- Limit results to a unit, SG in this case
edan_schema= Filter results by specifying one of the valid EDAN schemas or record types (list at https://edandoc.si.edu/more.html#schemas)AppID= Your AppIDAppKey= Your AppKeyrows= How many rows to return, max is 100, default is 10start= Which row to start the results, default is 0
Example of setting your credentials and using metadata_search():
#EDAN creds
AppID = "APP_ID"
AppKey = "verylong_key"
#Search for images of orchids from Smithsonian Gardens
results = edan.metadata_search(q="orchids", fqs=["online_media_type:\"Images\"", "data_source:\"Smithsonian+Gardens\""], AppID=AppID, AppKey=AppKey)
#Number of results available for this search
results['rowCount']
#To get the rows of results
results_rows = results['rows']
To get the list of units:
unit_search = edan.metadata_search(edan_schema="si-unit", AppID=AppID, AppKey=AppKey, rows=100)
# Create a list with unit title, url in EDAN, and description
units = []
#iterate through the results and save to list
for i in range(len(unit_search['rows'])):
units.append([unit_search['rows'][i]['title'], unit_search['rows'][i]['url'], unit_search['rows'][i]['content']['description']])
content_getcontent() - Get details of a single item using the item ID
The function content_getcontent() takes these arguments (must provide either id or url):
id= ID of the itemurl= URL of the itemAppID= Your AppIDAppKey= Your AppKey
To see the details of an item:
import json
item = edan.content_getcontent(url=results['rows'][0]['url'], AppID=AppID, AppKey=AppKey)
print(json.dumps(item, sort_keys = True, indent = 4))
metadata_suggestions() - Returns a list of suggested content for a given search term
The function metadata_suggestions() takes these arguments:
suggest= Search termsAppID= Your AppIDAppKey= Your AppKey
Metadata
Release files for edan 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| edan-0.5.1.tar.gz | 8.8 kB | Without provenance | Details for edan-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| edan-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for edan-0.5.1-py3-none-any.whl |
Total release size: 17.0 kB
Release files / edan-0.5.1.tar.gz
| Download URL | edan-0.5.1.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e07caaf57fdd770643b5e66fa196fbda4bbfe7591abbda9f4ea038f5d69f9a87
|
|
BLAKE2b-256 checksum How to use checksums |
e4baf8ac1f119b0b351a450a7783cd1e0c0087ae8df14bfe78ee3aa101ea615c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.0rc1
|
Release files / edan-0.5.1-py3-none-any.whl
| Download URL | edan-0.5.1-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25747e358b5ed57cd41ca06bbfe2e70939b8438fc943f6aedf4d008e3d913fa3
|
|
BLAKE2b-256 checksum How to use checksums |
5914e906ee27c062ef298a6ce7a4bae68533fece783a4331f8b93c5b82f38f6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.0rc1
|
Security for edan 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.