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

« back to all changes in this revision

Viewing changes to utils.py

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2011-06-10 09:11:33 UTC
  • Revision ID: james.westby@ubuntu.com-20110610091133-04usv8rnmraq5f4j
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

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