Created
January 11, 2017 21:21
-
-
Save stucka/e1904c061a621c1ce48619922da4d859 to your computer and use it in GitHub Desktop.
Get page count for DocumentCloud projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install python-documentcloud | |
from documentcloud import DocumentCloud | |
import creds | |
username = "[email protected]" | |
password = "somethingsneaky" | |
projectsought = "Cool set of documents" | |
client = DocumentCloud(username, password) | |
project = client.projects.get(title=projectsought) | |
pagecount = 0 | |
for document in project.document_ids: | |
docobj = project.get_document(document) | |
pagecount += docobj.pages | |
print(str(pagecount) + " pages from " + str(len(project.document_ids)) + " documents found in " + projectsought) | |
# 5433 pages from 643 documents found in Cool set of documents |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment