Skip to content
Snippets Groups Projects
Commit 5c6fbfed authored by Daniel Russo-Batterham's avatar Daniel Russo-Batterham
Browse files

Setup get_fragment method

parent d0625a5e
Branches
No related tags found
No related merge requests found
......@@ -15,7 +15,9 @@ class TEIPublisherSession:
def login(self):
url = f"{self.endpoint}/login"
logging.info("Logging in")
return self.session.post(url, data={"user": self.username, "password": self.password})
return self.session.post(
url, data={"user": self.username, "password": self.password}
)
def upload_file(self, filepath, collection):
url = f"{self.endpoint}/upload/{collection}"
......@@ -26,7 +28,9 @@ class TEIPublisherSession:
def recompile_odd(self, filepath, check_compiles="true"):
url = f"{self.endpoint}/odd"
logging.info("Recompiling ODD")
return self.session.post(url, params={"odd": ntpath.basename(filepath), "check": check_compiles})
return self.session.post(
url, params={"odd": ntpath.basename(filepath), "check": check_compiles}
)
def logout(self):
logging.info("Logging out")
......@@ -51,3 +55,25 @@ class TEIPublisherSession:
params = {"odd": odd, "wc": "true"}
return self.session.get(url, params=params)
def get_fragment(
self,
collection,
document,
odd,
xpath=None,
output_format="html",
view="single",
id=None,
):
url = f"{self.endpoint}/document/{collection}%2F{document}/{output_format}?"
params = {
"odd": odd,
"xpath": xpath,
"id": None,
"view": view,
"id": id,
}
return self.session.get(url, params=params)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment