[英]How to read/modify a local file of HTML5 Local Storage from Python?
I did an Ubuntu Webapp and I'd like to create a Preferences dialog with a litte hack.我做了一个Ubuntu Webapp ,我想用一个小技巧创建一个首选项对话框。
From the webapp I can storage/retrieve values with HTML5:从 webapp 我可以使用 HTML5 存储/检索值:
if (localStorage.getItem('showNotifications')) {
// Enabling notifications...
}
I found this file in Ubuntu:我在 Ubuntu 中找到了这个文件:
/home/costales/.local/share/Telegramzhukovgithubio/Local Storage/http_zhukov.github.io_0.localstorage
I'd like to launch an independent Python dialog with a few preferences (show notifications, autostart...), that python app reads/writes values in that file, then the webapp will read it and setting that configuration.我想启动一个带有一些首选项(显示通知、自动启动...)的独立 Python 对话框,该 Python 应用程序读取/写入该文件中的值,然后 Web 应用程序将读取它并设置该配置。
Is possible to read/write that values from the .localstorage file in Python?是否可以从 Python 中的 .localstorage 文件读取/写入这些值? Please,how?
请问怎么办? Thanks in advance!
提前致谢!
This worked :)这有效:)
import sqlite3
conn = sqlite3.connect('/home/costales/.local/share/Telegramzhukovgithubio/Local Storage/http_zhukov.github.io_0.localstorage')
c = conn.cursor()
c.execute("SELECT key,value FROM ItemTable where key='count'")
print c.fetchone()
conn.close()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.