sciyoshi / pyfacebook
- Source
- Commits
- Network (28)
- Issues (11)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
-
Hi,
I cannot get a session with an web application:
{u'error_code': 100, u'error_msg': u'Invalid parameter', u'request_args': [{u'value': u'JSON', u'key': u'format'}, {u'value': u'...', u'key': u'auth_token'}, {u'value': u'...', u'key': u'sig'}, {u'value': u'1.0', u'key': u'v'}, {u'value': u'...', u'key': u'api_key'}, {u'value': u'facebook.auth.getSession', u'key': u'method'}]}
I always get a error 100... what could be the possible errors?
I do something as simple as :
self.api.auth_token = auth_datas['auth_token'] # getSession sets the session_key and uid self.api.auth.getSession() self.authenticated = TrueComments
-
I got integrity error as explained in http://forum.developers.facebook.com/viewtopic.php?pid=152522#p152522 and it's caused by a limit of pyfacebook lib or database model.
I moved id from int(11) to varchar(20) and moved from
user, created = self.get_or_create(id=int(facebook.uid))
to
user, created = self.get_or_create(id=facebook.uid)now it works and in mysql I get 100000000130682 as a user id (that caused the error, because it was changed to 2147483647 when saving).
it seems a very strange facebook id, I think it's a problem of the library...
Comments
-
Hello,
i want to use Stream.publish, http://wiki.developers.facebook.com/index.php/Stream.publish
but this feature is not avaible on pyfacebook ?
Comments
is it really not available?
it's sitting right there, line 553 in the current version of the source ( facebook/init.py )
might have to enable the stream publishing permissions for the user, though, otherwise your program is not allowed to post on behalf of the user.You can do that by going to this address (after replacing the YOUR_API_KEY with your real api key):
http://www.facebook.com/authorize.php?api_key=YOUR_API_KEY&v=1.0&ext_perm=publish_stream -
I'm having problems with the "added" instance variable. It seems to be
sticking at False even though indeed the user has authorized the
application.Here's the relevant part of my code, I'm working in Google App Engine:
class MainPage(webapp.RequestHandler): def get(self): fb = facebook.Facebook(_FbApiKey, _FbSecret, app_name=_FbAppName) if fb.check_session(self.request) and fb.added: pass else: url = fb.get_add_url(next=fb.get_app_url()) self.response.out.write('<script language="javascript">top.location.href="' + url + '"</script>') return self.response.out.write("<html><body>You are now logged in and you added the app!</body></html>")It's getting into an infinite redirect cycle, because fb.added is
always False. The first time, check_session returns False, but after
logging in and authorizing the application, it returns True. In any
case, fb.added is always False.
Comments
-
patch for admin.banUsers and friends.get method
0 comments Created 3 months ago by kevin3210diff --git a/facebook/__init__.py b/facebook/__init__.py index 3813142..3e9a74d 100644 --- a/facebook/__init__.py +++ b/facebook/__init__.py @@ -127,6 +127,9 @@ METHODS = { 'getAllocation': [ ('integration_point_name', str, []), ], + 'banUsers': [ + ('uids', list, []), + ], }, # auth methods @@ -225,6 +228,7 @@ METHODS = { ], 'get': [ + ('uid', int, ['optional']), ('flid', int, ['optional']), ],Comments
-
Seems the test10 mock httplib.HTTP, however the code is using httplib.HTTPConnection.
Index: tests/test.py =================================================================== --- tests/test.py (revision 4720) +++ tests/test.py (working copy) @@ -232,20 +232,19 @@ fb = facebook.Facebook(my_api_key, my_secret_key) fb.login = self.login - facebook.httplib.HTTP = Mock('httplib.HTTP') + facebook.httplib.HTTPConnection = Mock('httplib.HTTPConnection') http_connection = Mock('http_connection') - facebook.httplib.HTTP.mock_returns = http_connection + facebook.httplib.HTTPConnection.mock_returns = http_connection http_connection.send.mock_returns_func = self.send - def _http_passes(): - return [200,] - http_connection.getreply.mock_returns_func = _http_passes - def read(): response = {"stuff":"stuff"} response_str = simplejson.dumps(response) return response_str - http_connection.file.read.mock_returns_func = read - + mock_response = Mock('httplib.HTTPResponse') + mock_response.status = 200 + mock_response.read.mock_returns_func = read + http_connection.getresponse.mock_returns = mock_response + response = {"session_key":"key","uid":"my_uid","secret":"my_secret","expires":"my_expires"} response_str = simplejson.dumps(response) res = fb.auth.getSession()Comments
-
Notes API do not support,hope it can support immediate
Comments
-
notifications.sendEmail doen't return any error code
0 comments Created about 1 month ago by manelvfHi,
Using this code:
result = request.facebook.notifications.sendEmail( userList, "Hello", "World" )where userList is a list of user ids.
When this code executes, result hasn't any value and users doen't receive any email. I think that it should return an error code as in :
http://wiki.developers.facebook.com/index.php/Notifications.sendEmailComments
-
Why does check_session return True when canvas_user is in params?
0 comments Created about 1 month ago by lackerI was using the require_login decorator and noticed that when people arrived at my app for the first time by clicking a link from a request, it wasn't asking them to allow access, and various pyfacebook calls were failing. I tracked this down to the part of check_session:
elif 'canvas_user' in params: self.uid = params['canvas_user'] else: return False return TrueIn this case there is a canvas_user but we don't have a valid session_key. Shouldn't that mean that check_session returns False, and thus the require_login decorator will redirect the user to allow access?
Comments
-
Using pyfacebook with pylons has issues with redirects nesting inside the application iframe. It appears this issue was already addressed for Django with commit http://github.com/sciyoshi/pyfacebook/commit/2a6b442c0e2d7674f9c347a340045286d3ece8f2. Additionally, the transition from Paster to WebOb HTTP exceptions on an earlier commit needed some updates as some variable names differ.
Not sure of the best way to paste in this patch (all in wsgi.py), so here goes:
Top of the file:
import reReplace CanvasRedirect definition with:
class CanvasRedirect(HTTPOk): """This is for redirects within the canvas using FBML.""" try: from string import Template except ImportError: from webob.util.stringtemplate import Template html_template_obj = Template('<html><head></head><body>${body}</body></html>') body_template_obj = Template('<fb:redirect url="${location}" />') def __init__(self, location): HTTPOk.__init__(self, headers = { 'location': location } ) class TopLevelRedirect(HTTPOk): """This is for redirects to top-level Facebook pages.""" try: from string import Template except ImportError: from webob.util.stringtemplate import Template html_template_obj = Template('<html><head></head><body>${body}</body></html>') body_template_obj = Template('<script type="text/javascript">\ntop.location.href = "${location}";\n</script>') def __init__(self, location): HTTPOk.__init__(self, headers = { 'location': location } )Change definition of redirect_to:
def redirect_to(self, url): """Wrap Pylons' redirect_to function so that it works in_canvas. By the way, this won't work until after you call check_session(). """ if self.in_canvas: raise CanvasRedirect(url) elif re.search("^https?:\/\/([^\/]*\.)?facebook\.com(:\d+)?", url.lower()): raise TopLevelRedirect(url) else: pylons_redirect_to(url)Comments
-
I've used pyFacebook for weeks without any problem, but since this week every time I call
facebook.auth.getSession()
I receive this error:Traceback (most recent call last):
File "../file.py", line 27, in nameFilefacebook.auth.getSession()File "../pyFacebook/Facebook.py", line 669, in getSession
result = self._client('%s.getSession' % self._name, args)File "../pyFacebook/Facebook.py", line 1110, in call
return self._parse_response(response, method)File "../pyFacebook/Facebook.py", line 1047, in _parse_response
self._check_error(result)File "../pyFacebook/Facebook.py", line 998, in _check_error
raise FacebookError(response['error_code'], response['error_msg'], response['request_args'])pyFacebook.Facebook.FacebookError: Error 100: Invalid parameter
Anyone can help me?
Thank youComments





Actually it seems that getSession works the first time with the token...
But then when I do
I get this error 100...
The data are of this form :
{'session_key': u'2.gNsdfasdq601_ONXo12BQ__.86400.1245423600-536937787', 'uid': 536937787}
Any idea? Please I am really depending on your API!?
What about is :
http://www.shuningbian.net/2009/05/facebook-python-authentication-gateway.php
Don't you do this in the wrong order? My code works perfectly fine as