本文整理汇总了Python中facebook.Facebook.photos_upload方法的典型用法代码示例。如果您正苦于以下问题:Python Facebook.photos_upload方法的具体用法?Python Facebook.photos_upload怎么用?Python Facebook.photos_upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类facebook.Facebook
的用法示例。
在下文中一共展示了Facebook.photos_upload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: file
# 需要导入模块: from facebook import Facebook [as 别名]
# 或者: from facebook.Facebook import photos_upload [as 别名]
continue
im = Image.open(fullpath)
ratio = (1.0*im.size[0])/im.size[1]
#print "im.size",im.size,ratio
if ratio<1.0:
ratio = 1.0/ratio
#print "ratio",ratio
if ratio>3.0:
print "file '%s' has ratio %.2f, which exceeds 3.0, so facebook won't like it..."%(x,ratio)
continue
#raise Exception
added +=1
#raise Exception
data = file(fullpath,"r").read()
try:
facebook.photos_upload(data,caption=x,aid=folders[folder]['aid'])
except FacebookError,e:
if e.code() == 321: #album full
findex +=1
folder = "%s %d"%(truefolder,findex)
createfolder(folder)
else:
raise
done.append(truefolder)
dump(done,file("done","wb"))