本文整理汇总了Python中facebook.Facebook.secret方法的典型用法代码示例。如果您正苦于以下问题:Python Facebook.secret方法的具体用法?Python Facebook.secret怎么用?Python Facebook.secret使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类facebook.Facebook
的用法示例。
在下文中一共展示了Facebook.secret方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from facebook import Facebook [as 别名]
# 或者: from facebook.Facebook import secret [as 别名]
file_uid_write.write(str(session['uid']))
file_uid_write.close()
file_secret_write = open(unicode(home)+unicode("faccialibro.secret"),"w+")
file_secret_write.write(str(session['secret']))
file_secret_write.close()
else:
file_uid = open(unicode(home)+unicode("faccialibro.user-id"),"r")
uid_read = file_uid.read()
file_uid.close()
file_secret = open(unicode(home)+unicode("faccialibro.secret"),"r")
secret_read = file_secret.read()
file_secret.close()
fb = Facebook(api_key='261918900490462', secret_key='c2bb3994ddcd0078e33bc9fb63daa434')
fb.session_key = session_read
fb.uid = uid_read
fb.secret = secret_read
loop = GObject.MainLoop()
launcher = Unity.LauncherEntry.get_for_desktop_id ("Faccialibro.desktop")
current_unseen = 0
unseen_changed = False
def updates():
global current_unseen, unseen_changed
notifiche = fb.notifications.get()
unseen = notifiche['notification_counts']['unseen'] + notifiche['messages']['unseen'] + notifiche['friend_requests_counts']['unseen']
if unseen == current_unseen:
unseen_changed = False
elif unseen > 0:
launcher.set_property("count", unseen)
launcher.set_property("count_visible", True)
if unseen > current_unseen:
unseen_changed = True
示例2: open
# 需要导入模块: from facebook import Facebook [as 别名]
# 或者: from facebook.Facebook import secret [as 别名]
from facebook import Facebook
from pickle import dump,load
from urllib2 import *
from xml.dom.minidom import parse
from time import sleep,localtime,strftime
# Get api_key and secret_key from a file
fbs = open('facebook_keys.txt').readlines()
facebook = Facebook(fbs[0].strip(), fbs[1].strip())
while True:
print strftime("%a, %d %b %Y %H:%M:%S", localtime())
try:
session = load(file(".session"))
print session
facebook.secret = session['secret']
facebook.session_key = session['session_key']
facebook.session_key_expires = session['expires']
facebook.uid = session['uid']
except (EOFError,IOError):
token = facebook.auth.createToken()
print "token",facebook.auth._client.auth_token
# Show login window
facebook.login()
# Login to the window, then press enter
print 'After logging in, press enter...'
raw_input()
res = facebook.auth.getSession()
dump(res,file(".session","w"))