示例#1
0
def _setProfileFBML(session_key, fbml):
    gminifb.call(
        "facebook.profile.setFBML",
        _FbApiKey,
        _FbSecret,
        session_key=session_key,
        markup=fbml)
示例#2
0
def _publishUserAction(session_key, note):
    gminifb.call(
        "facebook.feed.publishActionOfUser",
        _FbApiKey,
        _FbSecret,
        session_key=session_key,
        title=note)
示例#3
0
def _getAppFriends(session_key):
    """Retrieve friends of the logged in user who have installed this app """
    usersInfo = gminifb.call("facebook.friends.getAppUsers",
                             _FbApiKey,
                             _FbSecret,
                             session_key=session_key)
    return usersInfo
示例#4
0
def _getFriends(session_key):
    usersInfo = [
        int(i) for i in gminifb.call("facebook.friends.get",
                                     _FbApiKey,
                                     _FbSecret,
                                     session_key=session_key)
    ]
    return usersInfo
示例#5
0
def _getAppFriends(session_key):
    """Retrieve friends of the logged in user who have installed this app """
    usersInfo = gminifb.call(
        "facebook.friends.getAppUsers",
        _FbApiKey,
        _FbSecret,
        session_key=session_key)
    return usersInfo
示例#6
0
def _getUsersInfo(session_key, uidList):
	# Lookup username and details

	usersInfo = gminifb.call("facebook.users.getInfo",
							_FbApiKey, _FbSecret, session_key=session_key,
							fields="name,pic_square",
							uids=",".join(["%s" % j for j in uidList])) # uids can be comma separated list
	
	return usersInfo
示例#7
0
def _getFriends(session_key):
    usersInfo = [
        int(i) for i in gminifb.call(
            "facebook.friends.get",
            _FbApiKey,
            _FbSecret,
            session_key=session_key)
    ]
    return usersInfo
示例#8
0
def _sendRequest(session_key, toIdList, content, appname = "hellominifb",
				 image = "http://keepnix.com/images/firestorms_trans_big.gif"):
	retInfo = gminifb.call("facebook.notifications.sendRequest",
							_FbApiKey, _FbSecret,
							session_key=data['minifb.validate']['session_key'],
							to_ids = ",".join(["%s" % j for j in toIdList]),
							type = appname,
							content = content,
							image = image,
							invite = "0") 
	return retInfo
示例#9
0
def _getUsersInfo(session_key, uidList):
    # Lookup username and details

    usersInfo = gminifb.call(
        "facebook.users.getInfo",
        _FbApiKey,
        _FbSecret,
        session_key=session_key,
        fields="name,pic_square",
        uids=",".join(["%s" % j
                       for j in uidList]))  # uids can be comma separated list

    return usersInfo
示例#10
0
def _getSessionKeyFromAuthToken(auth_token):
	"""Get the session key from the auth_token

	For certain apis such as postadd and postremove instead of being given
	the standard signed values we are given the auth_token which we are
	to use to get the session key using a call to getSession
	"""
	
	result = gminifb.call("facebook.auth.getSession",
						 _FbApiKey, _FbSecret, auth_token=auth_token)
	uid = result["uid"]
	session_key = result["session_key"]

	return (session_key, uid)
示例#11
0
def _sendRequest(session_key,
                 toIdList,
                 content,
                 appname="hellominifb",
                 image="http://keepnix.com/images/firestorms_trans_big.gif"):
    retInfo = gminifb.call("facebook.notifications.sendRequest",
                           _FbApiKey,
                           _FbSecret,
                           session_key=data['minifb.validate']['session_key'],
                           to_ids=",".join(["%s" % j for j in toIdList]),
                           type=appname,
                           content=content,
                           image=image,
                           invite="0")
    return retInfo
示例#12
0
def _getSessionKeyFromAuthToken(auth_token):
    """Get the session key from the auth_token

	For certain apis such as postadd and postremove instead of being given
	the standard signed values we are given the auth_token which we are
	to use to get the session key using a call to getSession
	"""

    result = gminifb.call("facebook.auth.getSession",
                          _FbApiKey,
                          _FbSecret,
                          auth_token=auth_token)
    uid = result["uid"]
    session_key = result["session_key"]

    return (session_key, uid)
示例#13
0
def _sendNotification(session_key, note, toIdList):
	"""Send a basic facebook notification to one or more users

	Watch out for the return value of this function.  If retInfo
	is a URL, i.e. retInfo[:4] == "http" you will need to redirect
	the user's browser to it for the user to manually confirm the
	sending of these notifications.  You can provide a &next= parameter
	to the url which the user will be sent to after the confirmation.
	If retInfo is not a url the notifications will be sent without
	manual confirmation.

	Notifications can also include an email component check the
	Facebook wiki for more information on this.
	"""
	retInfo = gminifb.call("facebook.notifications.send",
							_FbApiKey, _FbSecret,
							session_key=session_key,
							notification=note,
							to_ids="%s" % ",".join(["%s" % i for i in toIdList]) )
	return retInfo
示例#14
0
def _sendNotification(session_key, note, toIdList):
    """Send a basic facebook notification to one or more users

	Watch out for the return value of this function.  If retInfo
	is a URL, i.e. retInfo[:4] == "http" you will need to redirect
	the user's browser to it for the user to manually confirm the
	sending of these notifications.  You can provide a &next= parameter
	to the url which the user will be sent to after the confirmation.
	If retInfo is not a url the notifications will be sent without
	manual confirmation.

	Notifications can also include an email component check the
	Facebook wiki for more information on this.
	"""
    retInfo = gminifb.call("facebook.notifications.send",
                           _FbApiKey,
                           _FbSecret,
                           session_key=session_key,
                           notification=note,
                           to_ids="%s" % ",".join(["%s" % i
                                                   for i in toIdList]))
    return retInfo
示例#15
0
def _setProfileFBML(session_key, fbml):
    gminifb.call("facebook.profile.setFBML",
                 _FbApiKey,
                 _FbSecret,
                 session_key=session_key,
                 markup=fbml)
示例#16
0
def _publishUserAction(session_key, note):
    gminifb.call("facebook.feed.publishActionOfUser",
                 _FbApiKey,
                 _FbSecret,
                 session_key=session_key,
                 title=note)