Python wrapper for the CNX Archive API(http://archive.cnx.org)
Project description
A Python wrapper around the Archive web api.
Quick start
Instantiate the ArchiveClient:
client = ArchiveClient()
Get a collection:
collection = client.get_collection("7fccc9cf-9b71-44f6-800b-f9457fd64335")
You now have access to lots of information about the collection.
collection.title
>> "Chemistry 2e"
collection.version
>> "9.18"
If you need to access a subcollection or module you can explore collection.table_of_contents
toc = collection.table_of_contents
for item in toc.contents
print(item)
>><Module [Preface]>
>><SubCollection [Essential Ideas]>
>><SubCollection [Atoms, Molecules, and Ions]>
>><SubCollection [Composition of Substances and Solutions]>
You can grab a module from the contents and get other information:
module = toc.contents[0]
print(module.title)
>>"Preface"
print(module.html_title)
>>"<span class="os-text">Preface</span>"
If you want to print the json or the html version you can do that too
module = toc.contents[0]
print(module.title)
>>"Preface"
module_html = module.get_html()
print(module_html)
>><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="robots" content="noindex"/></head><body><div data-type="page" id="138634ed-6ed0-4edb-b13d-b78d388028b0" class="preface" ...
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.