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.
26 lines
865 B
26 lines
865 B
import dropbox, yaml
|
|
import main.googleapi as gapi
|
|
|
|
|
|
def writeToHtml(data):
|
|
with open('customData.yml', 'r') as file:
|
|
custmdata = yaml.safe_load(file)
|
|
|
|
dbx = dropbox.Dropbox(custmdata['dropKey'])
|
|
|
|
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)
|
|
|
|
# Dropbox Link
|
|
# with open('COMBO_MO_MOBIL.htm', 'rb') as f:
|
|
# dbx.files_upload(f.read(), "/COMBO_MO_MOBIL.htm", mode=dropbox.files.WriteMode("overwrite"))
|
|
|
|
# Google Drive Link
|
|
gapi.upload_basic() |