conduit r1449 - in trunk: . conduit/modules/FacebookModule/pyfacebook scripts test/python-tests
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1449 - in trunk: . conduit/modules/FacebookModule/pyfacebook scripts test/python-tests
- Date: Mon, 5 May 2008 23:26:04 +0100 (BST)
Author: jstowers
Date: Mon May 5 22:26:04 2008
New Revision: 1449
URL: http://svn.gnome.org/viewvc/conduit?rev=1449&view=rev
Log:
2008-05-06 John Stowers <john stowers gmail com>
* NEWS:
* conduit/modules/FacebookModule/pyfacebook/__init__.py:
* conduit/modules/FacebookModule/pyfacebook/no-print-at-import.patch:
* test/python-tests/TestDataProviderFacebook.py:
* test/python-tests/TestDataProviderFlickr.py: Update to latest version
of pyfacebook.
Removed:
trunk/conduit/modules/FacebookModule/pyfacebook/no-print-at-import.patch
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/conduit/modules/FacebookModule/pyfacebook/__init__.py
trunk/scripts/ChangeLog
trunk/scripts/update-3rdparty-libs.sh
trunk/test/python-tests/TestDataProviderFacebook.py
trunk/test/python-tests/TestDataProviderFlickr.py
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Mon May 5 22:26:04 2008
@@ -1,6 +1,7 @@
NEW in 0.3.11:
==============
* Support ZOTO Photos
+* Update to latest version of pyfacebook
NEW in 0.3.10:
==============
Modified: trunk/conduit/modules/FacebookModule/pyfacebook/__init__.py
==============================================================================
--- trunk/conduit/modules/FacebookModule/pyfacebook/__init__.py (original)
+++ trunk/conduit/modules/FacebookModule/pyfacebook/__init__.py Mon May 5 22:26:04 2008
@@ -2,9 +2,30 @@
#
# pyfacebook - Python bindings for the Facebook API
#
-# See AUTHORS for a list of authors, and COPYING for
-# copyright information.
-
+# 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 <organization> 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 <copyright holder> ``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 <copyright holder> 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.
"""
Python bindings for the Facebook API (pyfacebook - http://code.google.com/p/pyfacebook)
@@ -21,8 +42,6 @@
is much faster than XML and also uses less bandwith. Go to
http://undefined.org/python/#simplejson to download it, or do
apt-get install python-simplejson on a Debian-like system.
-
-Licensed under the LGPL.
"""
import md5
@@ -45,6 +64,31 @@
from xml.dom import minidom
RESPONSE_FORMAT = 'XML'
+# support Google App Engine. GAE does not have a working urllib.urlopen.
+try:
+ from google.appengine.api import urlfetch
+
+ def urlread(url, data=None):
+ if data is not None:
+ headers = {"Content-type": "application/x-www-form-urlencoded"}
+ method = urlfetch.POST
+ else:
+ headers = {}
+ method = urlfetch.GET
+
+ result = urlfetch.fetch(url, method=method,
+ payload=data, headers=headers)
+
+ if result.status_code == 200:
+ return result.content
+ else:
+ raise urllib2.URLError("fetch error url=%s, code=%d" % (url, result.status_code))
+
+except ImportError:
+ def urlread(url, data=None):
+ res = urllib2.urlopen(url, data=data)
+ return res.read()
+
__all__ = ['Facebook']
VERSION = '0.1'
@@ -54,6 +98,8 @@
FACEBOOK_URL = 'http://api.facebook.com/restserver.php'
FACEBOOK_SECURE_URL = 'https://api.facebook.com/restserver.php'
+class json(object): pass
+
# simple IDL for the Facebook API
METHODS = {
# feed methods
@@ -89,7 +135,9 @@
'publishTemplatizedAction': [
# facebook expects title_data and body_data to be JSON
# simplejson.dumps({'place':'Florida'}) would do fine
+ # actor_id is now deprecated, use page_actor_id instead
('actor_id', int, []),
+ ('page_actor_id', int, []),
('title_template', str, []),
('title_data', str, ['optional']),
('body_template', str, ['optional']),
@@ -155,6 +203,7 @@
# profile methods
'profile': {
'setFBML': [
+ ('markup', str, ['optional']),
('uid', int, ['optional']),
('profile', str, ['optional']),
('profile_action', str, ['optional']),
@@ -321,6 +370,21 @@
('fbml', str, []),
],
},
+
+ 'data': {
+ 'getCookies': [
+ ('uid', int, []),
+ ('string', str, []),
+ ],
+
+ 'setCookie': [
+ ('uid', int, []),
+ ('name', str, []),
+ ('value', str, []),
+ ('expires', int, ['optional']),
+ ('path', str, ['optional']),
+ ],
+ },
}
@@ -728,16 +792,17 @@
def __call__(self, method, args=None, secure=False):
"""Make a call to Facebook's REST server."""
+
post_data = urllib.urlencode(self._build_post_args(method, args))
if secure:
- response = urllib2.urlopen(FACEBOOK_SECURE_URL, post_data).read()
+ response = urlread(FACEBOOK_SECURE_URL, post_data)
else:
- response = urllib2.urlopen(FACEBOOK_URL, post_data).read()
+ response = urlread(FACEBOOK_URL, post_data)
return self._parse_response(response, method)
-
+
# URL helpers
def get_url(self, page, **args):
"""
@@ -771,7 +836,7 @@
def get_authorize_url(self, next=None, next_cancel=None):
"""
- Returns the URL that the user should be redirected to in order to add the application.
+ Returns the URL that the user should be redirected to in order to authorize certain actions for application.
"""
args = {'api_key': self.api_key, 'v': '1.0'}
Modified: trunk/scripts/update-3rdparty-libs.sh
==============================================================================
--- trunk/scripts/update-3rdparty-libs.sh (original)
+++ trunk/scripts/update-3rdparty-libs.sh Mon May 5 22:26:04 2008
@@ -7,14 +7,13 @@
fi
#update flickrapi
-svn export --force https://flickrapi.svn.sourceforge.net/svnroot/flickrapi/trunk/flickrapi/ conduit/modules/FlickrModule/flickrapi/
-patch -p0 < conduit/modules/FlickrModule/flickrapi/multi-username.patch
+#svn export --force https://flickrapi.svn.sourceforge.net/svnroot/flickrapi/trunk/flickrapi/ conduit/modules/FlickrModule/flickrapi/
+#patch -p0 < conduit/modules/FlickrModule/flickrapi/multi-username.patch
#update pyfacebook
svn export --force http://pyfacebook.googlecode.com/svn/trunk/facebook/__init__.py conduit/modules/FacebookModule/pyfacebook/__init__.py
-patch -p0 < conduit/modules/FacebookModule/pyfacebook/no-print-at-import.patch
#update pybackpack
-wget -qO - http://hg.west.spy.net/hg/python/backpack/archive/tip.tar.gz | tar --wildcards -xzOf - */backpack.py > conduit/modules/BackpackModule/backpack/backpack.py
+#wget -qO - http://hg.west.spy.net/hg/python/backpack/archive/tip.tar.gz | tar --wildcards -xzOf - */backpack.py > conduit/modules/BackpackModule/backpack/backpack.py
Modified: trunk/test/python-tests/TestDataProviderFacebook.py
==============================================================================
--- trunk/test/python-tests/TestDataProviderFacebook.py (original)
+++ trunk/test/python-tests/TestDataProviderFacebook.py Mon May 5 22:26:04 2008
@@ -17,8 +17,15 @@
except Exception, err:
ok("Logged in (%s)" % err, False)
+#Perform image tests
+#test.do_image_dataprovider_tests(
+# supportsGet=False,
+# supportsDelete=False,
+# safePhotoLUID=None
+# )
+
#Send a remote file
-f = File.File("http://files.conduit-project.org/screenshot.png")
+f = Photo.Photo(URI="http://files.conduit-project.org/screenshot.png")
try:
rid = facebook.put(f, True)
ok("Upload a photo (%s) " % rid, True)
Modified: trunk/test/python-tests/TestDataProviderFlickr.py
==============================================================================
--- trunk/test/python-tests/TestDataProviderFlickr.py (original)
+++ trunk/test/python-tests/TestDataProviderFlickr.py Mon May 5 22:26:04 2008
@@ -1,11 +1,6 @@
#common sets up the conduit environment
from common import *
-import traceback
-
-import conduit.datatypes.File as File
-import conduit.Vfs as Vfs
-
#Flickr is non-interactive once you have got a frob for the first time
if not is_online():
skip()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]