Skip to main content

Python module to query the Smithsonian's internal Enterprise Digital Asset Network (EDAN).

Project description

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 terms
  • fqs = 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 AppID
  • AppKey = Your AppKey
  • rows = How many rows to return, max is 100, default is 10
  • start = 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 item
  • url = URL of the item
  • AppID = Your AppID
  • AppKey = 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 terms
  • AppID = Your AppID
  • AppKey = Your AppKey

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

edan-0.5.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

edan-0.5.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file edan-0.5.1.tar.gz.

File metadata

  • Download URL: edan-0.5.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.0rc1

File hashes

Hashes for edan-0.5.1.tar.gz
Algorithm Hash digest
SHA256 e07caaf57fdd770643b5e66fa196fbda4bbfe7591abbda9f4ea038f5d69f9a87
MD5 b1199283282d5dd0f65865dfd417aa9b
BLAKE2b-256 e4baf8ac1f119b0b351a450a7783cd1e0c0087ae8df14bfe78ee3aa101ea615c

See more details on using hashes here.

File details

Details for the file edan-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: edan-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.0rc1

File hashes

Hashes for edan-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 25747e358b5ed57cd41ca06bbfe2e70939b8438fc943f6aedf4d008e3d913fa3
MD5 dad26bb5bd9893dcb1f8bcc01ed9dbbf
BLAKE2b-256 5914e906ee27c062ef298a6ce7a4bae68533fece783a4331f8b93c5b82f38f6f

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page