You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
891 B

import dropbox, yaml
def writeToHtml(data):
with open('customData.yml', 'r') as file:
prime_service = yaml.safe_load(file)
dbx = dropbox.Dropbox('sl.BzPippHAjsFYt3D-DtscfnXIORlVjcb10y9EajcnoGJ1zhF2oQ9btHWBcgiTeDWPhtwTnWkfd0D99jkZHiOuQNHcHsu9SEa9l4Wen7F4B1CiJ-EzsFkGEmaMBcyZnUxfxnij4kXsiU05')
with open('COMBO_MO_MOBIL.htm', 'r+') as f:
lines = f.readlines()
for i, line in enumerate(lines):
if '<!--@JS-DATA@-->' in line:
lines[i] = ' <!--@JS-DATA@-->' + '<script>const myDATA =' + str(data) + '</script>\n'
f.truncate()
f.seek(0) # rewrite into the file
for line in lines:
f.write(line)
with open('COMBO_MO_MOBIL.htm', 'rb') as f:
dbx.files_upload(f.read(), "/COMBO_MO_MOBIL.htm", mode=dropbox.files.WriteMode("overwrite"))

Powered by TurnKey Linux.