Created
July 7, 2021 19:19
-
-
Save bmorphism/d8a51feb49ca110633b115aa538a1c08 to your computer and use it in GitHub Desktop.
Exhibit A: Reveries from our classist past
This file contains 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
class Document: | |
def __init__(self, source_doc, dest_doc): | |
'''Instantiate the document object with Google Docs id and Destination Name''' | |
self.source_doc = source_doc | |
self.dest_doc = dest_doc | |
self.content = [""] | |
self.processed = "" | |
def get_document(self): | |
''' | |
Use Google API to get the contents of the document | |
needs to handle API authentication | |
__|__ | |
*---o--(_)--o---* | |
self.source_doc is an identifier for the document in API | |
read in content API responce into a list of strings in self.content | |
returns self.content and assigns it inplace | |
''' | |
print("Getting the document.") | |
pass | |
def process_document(self): | |
''' | |
Prepare the document content extracted from the API for sending to the form | |
process the strings in self.content and combine into a single long formatted string | |
returns self.processed and assigns it inplace | |
''' | |
print("Processing the document.") | |
pass | |
def publish_document(self): | |
''' | |
Send the formatted document from self.processed into a destination form | |
self.content needs to be sent to the target system using an API, | |
an existing protocol to transfer files, or Selenium if a web-form | |
self.name is the identifier of the document in the target system | |
returns status code of the operation | |
''' | |
print("Publishing the document.") | |
pass | |
example = Document("i_am_a_doc_id", "i_am_a_target_name") | |
example.get_document() | |
example.process_document() | |
example.publish_document() | |
# you could also interact with the outputs of each to figure out how to process them by assigning, as in | |
# document_content = example.get_document() | |
# processed = example.process_document() and so on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment