0

I did an Ubuntu Webapp and I'd like to create a Preferences dialog with a litte hack.

From the webapp I can storage/retrieve values with HTML5:

if (localStorage.getItem('showNotifications')) {
    // Enabling notifications...
}

I found this file in 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.

Is possible to read/write that values from the .localstorage file in Python? Please,how? Thanks in advance!

Talha
  • 903
  • 8
  • 31
Costales
  • 2,799
  • 1
  • 17
  • 21

1 Answers1

3

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()
Costales
  • 2,799
  • 1
  • 17
  • 21
  • 1
    Thank you, costales. This helped me a lot! Note: under Windows 10 Chrome currently (version 55.0.2883.87 m) keeps its Web Storage files in this folder: "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Local Storage\" – Dave Burton Jan 07 '17 at 12:17