本文整理汇总了Python中facebook.Facebook.image_post方法的典型用法代码示例。如果您正苦于以下问题:Python Facebook.image_post方法的具体用法?Python Facebook.image_post怎么用?Python Facebook.image_post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类facebook.Facebook
的用法示例。
在下文中一共展示了Facebook.image_post方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FacebookApp
# 需要导入模块: from facebook import Facebook [as 别名]
# 或者: from facebook.Facebook import image_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