Skip to content

ClevelandMuseumArt/openaccess_cma_package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cleveland Museum of Art's Open Access API Python Module

This python module provides a wrapper function with error checking for the CMA open access API, API documentation can be found here. The function returns a tuple containing in the first entry a python dictionary representing the Open Access API's JSON response to the query, and in the second value the URL used to make the query.

The wrapper function is

openaccess_cma_search() 

An example usage of the function is,

d, q = openaccess_cma_search(q="monet", limit="10") 

Please see CMA's open-access API documentation for a full list of arguments to the wrapper function. The function implements all parameters specified in the API documentation.

For API parameters that take no argument such as "female_artists", the function will include the parameter if given a truthy argument (any argument that when cast as a Boolean returns true). For example,

d, q = openaccess_cma_search(female_artists="True", limit=1)
print(q)

will output ...

https://openaccess-api.clevelandart.org/api/artworks/?female_artists&limit=1

And

d, q = openaccess_cma_search(female_artists=0, limit=1)
print(q)

will output...

https://openaccess-api.clevelandart.org/api/artworks/?limit=1

Examples

The following query returns three artworks acquired by CMA produced by African American Cleveland Institute of Art alumni.

d,q = openaccess_cma_search(african_american_artists=True, cia_alumni_artists="1", limit=3)

The following query returns all CMA artworks in the modern European painting and sculpture department produced by Picasso connected with Nazi art looting.

d,q = openaccess_cma_search(artists="Picasso", department="Modern European Painting and Sculpture", nazi_era_provenance='1')

The following query returns the maximum number of CMA artworks obtainable in one query (1000) produced by female artists.

d,q = openaccess_cma_search(female_artists="A string that is true")

Enjoy exploring the CMA's collection!

About

Repository containing the openaccess_cma python package.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages