Skip to content

Instantly share code, notes, and snippets.

@stucka
Created January 11, 2017 21:21
Show Gist options
  • Save stucka/e1904c061a621c1ce48619922da4d859 to your computer and use it in GitHub Desktop.
Save stucka/e1904c061a621c1ce48619922da4d859 to your computer and use it in GitHub Desktop.
Get page count for DocumentCloud projects
# 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