def add_document(self, document):
documents_url = urljoin(self.base_url, self.DOCUMENTS_PAGE)<EOL>data = {"<STR_LIT>": self.url}<EOL>files = {"<STR_LIT>": document}<EOL>result = self.session.post(documents_url, data=data, files=files)<EOL>if result.status_code == <NUM_LIT>:<EOL><INDENT>return Document(session=self.session, **result.json())<EOL><DEDENT>else:<EOL><INDENT>raise RuntimeError("<STR_LIT>"<EOL>"<STR_LIT>".format(result.status_code,<EOL>result.text))<EOL><DEDENT>
Add a document to this corpus

`document' is passed to `requests.post', so it can be a file-like
object, a string (that will be sent as the file content) or a tuple
containing a filename followed by any of these two options.