CNX存档API的Python封装器(http://archive.cnx.org)
项目描述
围绕Archive Web API的Python封装器。
快速入门
实例化ArchiveClient
client = ArchiveClient()
获取集合
collection = client.get_collection("7fccc9cf-9b71-44f6-800b-f9457fd64335")
您现在可以访问有关集合的大量信息。
collection.title
>> "Chemistry 2e"
collection.version
>> "9.18"
如果您需要访问子集合或模块,可以探索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]>
您可以从内容中抓取一个模块并获取其他信息
module = toc.contents[0]
print(module.title)
>>"Preface"
print(module.html_title)
>>"<span class="os-text">Preface</span>"
如果您想打印json或html版本,也可以这样做
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" ...
项目详情
关闭
archive-api-client-0.0.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2e03be7859684b8378b9b4a8d511e8049a5eb2a20997f6fdc23f915abb94bdac |
|
MD5 | 147e19ccba3bca1be6f4402a95fae12c |
|
BLAKE2b-256 | 24743c095471af4f7ea18ebaa69ac90fb401c5df23d665571007d055865978ed |