== PyFacebook == PyFacebook is a Python client library for the Facebook API. Samuel Cormier-Iijima ([email protected]) Niran Babalola ([email protected]) Shannon -jj Behrens ([email protected]) David B. Edelstein ([email protected]) Max Battcher ([email protected]) Rohan Deshpande ([email protected]) Matthew Stevens ([email protected]) Sandro Turriate ([email protected]) Benjamin Zimmerman ([email protected]) Gisle Aas ([email protected]) Rand Bradley ([email protected]) Luke Worth ([email protected]) Andreas Cederström ([email protected]) Samuel Hoffstaetter ([email protected]) Andreas Ehn ([email protected]) Lee Li ([email protected]) http://github.com/sciyoshi/pyfacebook/ == Usage == To use this in your own projects, do the standard: python setup.py install == Documentation == Have a look at the examples/ directory. Most of the stuff should be self-explanatory. There is also an example Django app in examples/facebook, which should have enough to get you started. See the developer wiki for more information. == License == Copyright (c) 2008, Samuel Cormier-Iijima All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PyFacebook
Overview
Comments
-
Support for require_login(required_permissions='
- ')
It appears that pyfacebook does not support the required_permissions argument to require_login, unlike Facebook's php API: http://wiki.developers.facebook.com/index.php/Extended_permissions#Requiring_Extended_Permissions. Is this deliberate? Is there any plan to add support for this? Also, is there a workaround that would automatically prompt users adding an FBML app and "logging into" the app for the first time for extended permissions?
I've posted the same question to stackoverflow.com: http://stackoverflow.com/questions/2440327/require-extended-permissions-in-fbml-pyfacebook-app
-
Example app not working in Django 1.2.4
I tried to use this library with my integrated app in Django, without success.
For hours I tried to figure out why my app was looping to Facebook when using @facebook.require_login().
I followed different examples («fbsample/», different approaches in StackOverflow, forums, etcetera). I even tried to use the «fbsample/» app without modifications (except for FACEBOOK_API_KEY and FACEBOOK_SECRET_KEY, not a single line) and it's not working either.
Could you please try your own example code in order to see if it's working?
Thanks
-
pages.getInfo has incorrect parameters
The method template for pages.getInfo is as follows:
'pages': { 'getInfo': [ ('page_ids', list, ['optional']), ('uid', int, ['optional']), ],
This causes an Error 100 if one tries to use the getInfo method in a manner similar to users.getInfo. I think the parameters should be:
'pages': { 'getInfo': [ ('fields', list, [('default', ['name'])]), ('page_ids', list, ['optional']), ],
to conform with the API. I could be wrong, however; I've jsut started using PyFacebook.
-
ImportError during setup and Install
Traceback (most recent call last): File "setup.py", line 3, in
from setuptools import setup, find_packages ImportError: No module named setuptools Thats the error I found while trying to install. I will be looking for a solution.
-
Error was: No module named facebook.djangofb
Hello,
I'm having issues running python 2.7 with pyfacebook through wsgi with django1.2.3. This works fine using python 2.6 running locally using python manage.py runserver(django version 1.2.1). I can use the interpreter and import facebook.djangofb and make all the calls I make in my script but when I try to use it in django, it simply doesn't work on the server running python 2.7 so I know the version is not the issue. If anyone can point me in the right direction I would really appreciate it.
Thanks
-
Problem while running the test cases
I am getting following problem when I ran the tests\test.py
Traceback (most recent call last): File "C:/source/pyfacebook/tests\tests.py", line 227, in test10 import Image ImportError: No module named Image
-
fb.session_key_expires in its default state errors out
Running pyfacebook by itself causes an error to be generated.
Traceback (most recent call last): File "/Users/harrytruman/projects/d51/givingnetwork/parts/django/django/core/servers/basehttp.py", line 279, in run self.result = application(self.environ, self.start_response) File "/Users/harrytruman/projects/d51/givingnetwork/parts/django/django/core/servers/basehttp.py", line 651, in __call__ return self.application(environ, start_response) File "/Users/harrytruman/projects/d51/givingnetwork/parts/django/django/core/handlers/wsgi.py", line 245, in __call__ response = middleware_method(request, response) File "/Users/harrytruman/projects/d51/givingnetwork/parts/pyfacebook/facebook/djangofb/__init__.py", line 240, in process_response expire_time = datetime.utcfromtimestamp(fb.session_key_expires) TypeError: a float is required
-
undefined symbol: PyUnicodeUCS4_Decode in
didn't see this issue tracking system -> repost from google code site: _parse_response(response, method)
python version 2.4.3
What steps will reproduce the problem?
-
got latest init.py, renamed to facebook.py and dropped in same directory as my simple gt.py script.
-
script looks as follows:
!/usr/local/bin/python
import sys from facebook import Facebook
sys.stderr = sys.stdout
print "Content-Type: text/xml" # HTML is following print # blank line, end of headers
print "
Hello World: running version ",sys.versionfb = Facebook('
', ' ') fb.auth.createToken() fb.login() fb.auth.getSession() fb.users.getInfo([fb.uid], ['name', 'birthday']) print ""
-
view script via browser (Chrome v1)
What is the expected output? What do you see instead? expected: html page displaying "hello world python 2.4.3"
instead error with stacktrace printed:
Traceback (most recent call last): File "gt.py", line 14, in ? fb.auth.createToken() File "/home/clientsi/public_html/northshore/gt/facebook.py", line 602, in createToken token = self._client('%s.createToken' % self._name) File "/home/clientsi/public_html/northshore/gt/facebook.py", line 1002, in call return self._parse_response(response, method) File "/home/clientsi/public_html/northshore/gt/facebook.py", line 941, in _parse_response dom = minidom.parseString(response) File "/usr/lib/python2.4/xml/dom/minidom.py", line 1924, in parseString File "/usr/lib/python2.4/xml/dom/expatbuilder.py", line 32, in ? File "/usr/lib/python2.4/xml/parsers/expat.py", line 4, in ? ImportError: /usr/local/lib/python2.4/lib-dynload/pyexpat.so: undefined symbol: PyUnicodeUCS4_Decode
What version of the product are you using? On what operating system? Not sure? Can't find version info in any file on site... running on python v2.4.3 OS & Kernel version: Linux 2.6.28.5-grsec-sg2
-
-
Migrations -> New Data Permissions -> Error Code: 100
New permissions dialog seems to required additional parameters.
You can try the new dialog in your Canvas application settings in Facebook (Developer App -> Your App -> Settings -> Migrations -> "New Data Permissions" -> Enable)
and then catch error:
API Error Code: 100 API Error Description: Invalid parameter Error Message: Requires valid next URL.
Guess all of us may hit the issue in June because "(Migration ends on: June 1, 2010)"
-
Could someone please take a look at this. XFBML breaking app
Hi, I have been trying to solve this myself, but I cannot make any sense of it.
When I enable XFBML, my app will only log in the user once maybe twice, and then they get sent to the frontpage with a new auth_token attached to the url.
I have a thread about it here and the suggestion from XaeroDegreaz seems to be a bit off, but I am not sure. THREADLINK: http://forum.developers.facebook.com/viewtopic.php?pid=218519
Maybe this is not affection pyFacebook directly but it is causing it to deliver a cookie/session to the XFBML parser that is then changed for some reason and therefor nothing works.
Could someone with a greater understanding of pyFacebook please take a look in my thread and see if there is anything that can be done on this end, or I will have to continue hitting the facebook dev in the head till they stop breaking things for no reason.
Many thanks for any hepl you might be able to give. If you need any more info, just say the word and I will try to produce it as fast as I can.
-
Bug in signature generation with getPublicInfo and application_canvas_name
fb.application.getPublicInfo(application_canvas_name="name")
DEBUG: {'api_key': '000000000000my_key00000000000000', 'format': 'XML', 'application_canvas_name ': 'name', 'method': 'facebook.application.getPublicInfo', 'v': '1.0'}The DEBUG line is just a printout of the args argument to _hash_args(self, args, secret=None)
Notice that for some reason there is a ' ' space character after the application_canvas_name. This is causing signatures to fail.
The issue is on line 121 of facebook/init.py, http://github.com/sciyoshi/pyfacebook/blob/95fa6c33f002fb0b550df8ecb8619f9491848ec0/facebook/init.py#L121
-
Example does nothing apparently.
I don't know if I'm missing something but I cannot get to run the django example project. These are the steps I followed:
- Downloaded the project to my computer
- Created a VirtualEnv bundle wit django 1.1.4 in examples/fbsamples
- Edited settings.py and added FACEBOOK_API_KEY and FACEBOOK_SECRET_KEY with values of an existing app I own.
- Copied the facebook folder to examples/fbsamples (didn't install but this much should be enough)
- Ran the project with 'python manage.py runserver' and opened the address 127.0.0.1:8000/fbsample/ in Chrome
This only redirects me to my timelime. I'm using a mac with Lion and Python 2.7.1
-
Updating status message of the FB page i own??
set_status works fine for my personal fb page. I was just wondering if it is possible to set status message of the fb page i created using this api ?
For example if i own and manage a FB page say blah blah music band, will it be possible to update its status message using pyfacebook automatically ?
-
FacebookError: Error 453: A session key is required for calling this method
Hi
Here's the traceback
facebook.FacebookError FacebookError: Error 453: A session key is required for calling this method Traceback (most recent call last) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 68, in __call__ return self.application(environ, start_response) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 68, in __call__ return self.application(environ, start_response) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 272, in __call__ response = self.get_response(request) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/django/core/handlers/base.py", line 169, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/django/core/handlers/base.py", line 203, in handle_uncaught_exception return debug.technical_500_response(request, *exc_info) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/Users/dwickwire/Projects/federation/src/django-socialauth/socialauth/views.py", line 257, in facebook_login_done user = authenticate(request = request) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 55, in authenticate user = backend.authenticate(**credentials) File "/Users/dwickwire/Projects/federation/src/django-socialauth/socialauth/auth_backends.py", line 180, in authenticate fb_user = facebook.users.getLoggedInUser() File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/facebook/__init__.py", line 877, in facebook_method return self(method_name, params, signed=signed) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/facebook/__init__.py", line 900, in __call__ return self._client('%s.%s' % (self._name, method), args, signed=signed) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/facebook/__init__.py", line 1558, in __call__ return self._parse_response(response, method) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/facebook/__init__.py", line 1491, in _parse_response self._check_error(result) File "/Users/dwickwire/Projects/federation/lib/python2.7/site-packages/facebook/__init__.py", line 1438, in _check_error raise FacebookError(response['error_code'], response['error_msg'], response['request_args']) FacebookError: Error 453: A session key is required for calling this method
It was working just fine at one point, I seem to be intermittently getting this, any ideas?
-
local variable 'user' referenced before assignment
Trying to login authenticated user again using OpenID account throws exception.
patch below solved my problem: diff --git a/socialregistration/views.py b/socialregistration/views.py index 1788fef..f050dc2 100644 --- a/socialregistration/views.py +++ b/socialregistration/views.py @@ -305,7 +305,7 @@ def openid_callback(request, template='socialregistration/openid.html', except OpenIDProfile.DoesNotExist: # There can only be one profile with the same identity profile = OpenIDProfile.objects.create(user=request.user, identity=identity)
-
_connect(user, profile, client)
-
_connect(request.user, profile, client) return HttpResponseRedirect(_get_next(request))
-
-
"No module named facebook.djangofb"
Hello,
I got this message error and i don't understand what i did wrong.
When i use "import facebook.djangofb" in my console it works but not in my Django project.
Can someone help me?
Thank you