跳转到主要内容

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 (4.2 kB 查看哈希值)

上传时间

支持者:

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面