本文整理汇总了Python中facebook.Facebook.post方法的典型用法代码示例。如果您正苦于以下问题:Python Facebook.post方法的具体用法?Python Facebook.post怎么用?Python Facebook.post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类facebook.Facebook
的用法示例。
在下文中一共展示了Facebook.post方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from facebook import Facebook [as 别名]
# 或者: from facebook.Facebook import post [as 别名]
def main():
if args.twitter:
t = Twitter(args)
t.login()
t.get_tweepy_API()
if args.command == 'read':
t.read()
elif args.command == 'post':
t.post()
else:
t.delete()
if args.facebook:
f = Facebook(args)
f.login()
f.get_facepy_API()
if args.command == 'read':
f.read()
elif args.command == 'post':
f.post()
else:
f.delete()
示例2: FacebookApp
# 需要导入模块: from facebook import Facebook [as 别名]
# 或者: from facebook.Facebook import post [as 别名]
class FacebookApp(App):
post_status = StringProperty('-')
user_infos = StringProperty('-')
facebook = ObjectProperty()
def build(self):
global app
app = self
return FacebookUI()
def on_start(self):
self.facebook = Facebook(FACEBOOK_APP_ID,
permissions=['publish_actions', 'basic_info'])
global modal_ctl
modal_ctl = ModalCtl()
netcheck.set_prompt(modal_ctl.ask_connect)
self.facebook.set_retry_prompt(modal_ctl.ask_retry_facebook)
def fb_me(self):
def callback(success, user=None, response=None, *args):
if not success:
return
'''since we're using the JNIus proxy's API here,
we have to test if we're on Android to avoid implementing
a mock user class with the verbose Java user interface'''
if platform() == 'android' and response.getError():
Logger.info(response.getError().getErrorMessage())
if platform() == 'android' and not response.getError():
infos = []
infos.append('Name: {}'.format(user.getName()))
infos.append('FirstName: {}'.format(user.getFirstName()))
infos.append('MiddleName: {}'.format(user.getMiddleName()))
infos.append('LastName: {}'.format(user.getLastName()))
infos.append('Link: {}'.format(user.getLink()))
infos.append('Username: {}'.format(user.getUsername()))
infos.append('Birthday: {}'.format(user.getBirthday()))
location = user.getLocation()
if location:
infos.append('Country: {}'.format(location.getCountry()))
infos.append('City: {}'.format(location.getCity()))
infos.append('State: {}'.format(location.getState()))
infos.append('Zip: {}'.format(location.getZip()))
infos.append('Latitude: {}'.format(location.getLatitude()))
infos.append('Longitude: {}'.format(location.getLongitude()))
else:
infos.append('No location available')
else:
infos = ['ha', 'ha', 'wish', 'this', 'was', 'real']
self.user_infos = '\n'.join(infos)
self.facebook.me(callback)
def fb_post(self, text):
def callback(success, response=None, *args):
if platform() == 'android' and response.getError():
Logger.info(response.getError().getErrorMessage())
Logger.info(str(success))
for a in args:
Logger.info(str(a))
if success:
from time import time
self.post_status = 'message posted at {}'.format(time())
self.facebook.post(text, callback=callback)
def fb_image_post(self, description, image_path):
def callback(success, *args):
Logger.info(str(success))
for a in args:
Logger.info(str(a))
if success:
from time import time
self.post_status = 'message posted at {}'.format(time())
self.facebook.image_post(description, image_path, callback=callback)
def on_pause(self):
return True