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.
Source Distribution
File details
Details for the file archive-api-client-0.0.1.tar.gz
.
File metadata
- Download URL: archive-api-client-0.0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e03be7859684b8378b9b4a8d511e8049a5eb2a20997f6fdc23f915abb94bdac |
|
MD5 | 147e19ccba3bca1be6f4402a95fae12c |
|
BLAKE2b-256 | 24743c095471af4f7ea18ebaa69ac90fb401c5df23d665571007d055865978ed |