~ubuntu-branches/ubuntu/precise/gwibber-service-sina/precise-201203201005

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_sina_keys():
  for dir in xdg.BaseDirectory.xdg_data_dirs:
    if exists (join(dir, "gwibber", "plugins", "sina", "data", "sina")):
      prv_file = join(dir, "gwibber", "plugins", "sina", "data", "sina")
      f = open(prv_file, "r")
      try:
        data = eval(f.read())
      except:
        pass

  SINA_OAUTH_KEY = data["SINA_OAUTH_KEY"]
  SINA_OAUTH_SECRET = data["SINA_OAUTH_SECRET"]
  return SINA_OAUTH_KEY, SINA_OAUTH_SECRET