1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from os.path import join, exists, realpath import xdg def get_sohu_keys(): for dir in xdg.BaseDirectory.xdg_data_dirs: if exists (join(dir, "gwibber", "plugins", "sohu", "data", "sohu")): prv_file = join(dir, "gwibber", "plugins", "sohu", "data", "sohu") f = open(prv_file, "r") try: data = eval(f.read()) except: pass SOHU_OAUTH_KEY = data["SOHU_OAUTH_KEY"] SOHU_OAUTH_SECRET = data["SOHU_OAUTH_SECRET"] return SOHU_OAUTH_KEY, SOHU_OAUTH_SECRET |