fix encode/decodes
This commit is contained in:
parent
7c0b7dc574
commit
07ad435936
@ -14,20 +14,20 @@ def update_viewings_csv_file_from_page(token_id, token_secret):
|
||||
html_page = Bookstack.get_page_html(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, page_id)
|
||||
|
||||
soup = BeautifulSoup(html_page, 'html.parser')
|
||||
csv_data = soup.find("code").text.strip()
|
||||
csv_data = soup.find("code").text.strip().encode('utf-8')
|
||||
|
||||
existing_attachment_id = VCinemaUtils.get_viewings_csv_attachment_id(token_id, token_secret)
|
||||
|
||||
attachment = Bookstack.get_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, existing_attachment_id).decode('utf-8')
|
||||
attachment = Bookstack.get_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, existing_attachment_id)
|
||||
|
||||
existing_attachment_hash = hashlib.md5(attachment.encode('utf-8')).hexdigest()
|
||||
existing_attachment_hash = hashlib.md5(attachment).hexdigest()
|
||||
|
||||
page_hash = hashlib.md5(csv_data.encode('utf-8')).hexdigest()
|
||||
page_hash = hashlib.md5(csv_data).hexdigest()
|
||||
|
||||
if page_hash != existing_attachment_hash:
|
||||
print("updating file")
|
||||
# bookstack update file via api doesn't work
|
||||
Bookstack.post_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, "vcinema.csv", csv_data.encode("utf-8"), page_id)
|
||||
Bookstack.post_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, "vcinema.csv", csv_data, page_id)
|
||||
Bookstack.delete_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, existing_attachment_id)
|
||||
print("done")
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user