Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removing experimental and outdated v2 code to clean up for the v2 rel…

…ease.

git-svn-id: http://gdata-python-client.googlecode.com/svn/trunk@768 7ed92db3-4423-0410-a5bc-5f2579731264
  • Loading branch information...
commit 5310f13847aa65245e05cb6f93972b597b5e51f7 1 parent 3842b5f
j.s@google.com authored
23 MANIFEST
View
@@ -22,6 +22,7 @@ src/gdata/auth.py
src/gdata/client.py
src/gdata/data.py
src/gdata/gauth.py
+src/gdata/sample_util.py
src/gdata/service.py
src/gdata/test_config.py
src/gdata/test_config_template.py
@@ -29,8 +30,9 @@ src/gdata/test_data.py
src/gdata/urlfetch.py
src/gdata/alt/__init__.py
src/gdata/alt/appengine.py
+src/gdata/alt/app_engine.py
src/gdata/analytics/__init__.py
-src/gdata/analytics/appengine.py
+src/gdata/analytics/service.py
src/gdata/apps/__init__.py
src/gdata/apps/service.py
src/gdata/apps/emailsettings/__init__.py
@@ -42,6 +44,8 @@ src/gdata/apps/migration/service.py
src/gdata/base/__init__.py
src/gdata/base/service.py
src/gdata/blogger/__init__.py
+src/gdata/blogger/client.py
+src/gdata/blogger/data.py
src/gdata/blogger/service.py
src/gdata/books/__init__.py
src/gdata/books/service.py
@@ -170,10 +174,19 @@ src/gdata/tlslite/TLSConnection.py
src/gdata/tlslite/Session.py
src/gdata/tlslite/SharedKeyDB.py
src/gdata/tlslite/X509CertChain.py
+samples/base/baseItemTypesQueryExample.py
+samples/base/baseAttributesQueryExample.py
samples/base/baseQueryExample.py
samples/base/dryRunInsert.py
samples/blogger/BloggerExample.py
+samples/blogger/BloggerExampleV1.py
+samples/blogger/app/app.yaml
+samples/blogger/app/auth_required.html
+samples/blogger/app/list_blogs.html
+samples/blogger/app/blogapp.py
+samples/blogger/app/welcome.html
samples/calendar/calendarExample.py
+samples/codesearch/CodesearchExample.py
samples/contacts/contacts_example.py
samples/docs/docs_example.py
samples/finance/test_finance.py
@@ -182,6 +195,7 @@ samples/spreadsheets/spreadsheetExample.py
samples/webmastertools/AddDeleteExampleDotCom.py
samples/webmastertools/SitemapsFeedSummary.py
samples/webmastertools/SitesFeedSummary.py
+samples/oauth/2_legged_oauth.py
samples/oauth/oauth_example.py
samples/authsub/secure_authsub.py
samples/oauth/oauth_on_appengine
@@ -272,6 +286,8 @@ tests/gdata_tests/apps/migration/service_test.py
tests/gdata_tests/base/__init__.py
tests/gdata_tests/base/service_test.py
tests/gdata_tests/blogger/__init__.py
+tests/gdata_tests/blogger/data_test.py
+tests/gdata_tests/blogger/live_client_test.py
tests/gdata_tests/blogger/service_test.py
tests/gdata_tests/books/__init__.py
tests/gdata_tests/books/service_test.py
@@ -282,6 +298,9 @@ tests/gdata_tests/contacts/__init__.py
tests/gdata_tests/contacts/service_test.py
tests/gdata_tests/docs/__init__.py
tests/gdata_tests/docs/service_test.py
+tests/gdata_tests/docs/test.ppt
+tests/gdata_tests/docs/test.doc
+tests/gdata_tests/docs/test.csv
tests/gdata_tests/health/__init__.py
tests/gdata_tests/health/service_test.py
tests/gdata_tests/photos/__init__.py
@@ -338,6 +357,8 @@ pydocs/gdata.finance.html
pydocs/gdata.finance.service.html
pydocs/gdata.gauth.html
pydocs/gdata.geo.html
+pydocs/gdata.health.service.html
+pydocs/gdata.health.html
pydocs/gdata.html
pydocs/gdata.media.html
pydocs/gdata.photos.html
2  README.txt
View
@@ -1,4 +1,4 @@
- Copyright (C) 2006 Google Inc.
+ Copyright (C) 2006-2009 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
3  RELEASE_NOTES.txt
View
@@ -1,3 +1,6 @@
+=== 2.0.0 ===
+June 26, 2009 (revision ???)
+
=== 1.3.3 ===
June 5, 2009 (revision 724)
2  setup.py
View
@@ -20,7 +20,7 @@
setup(
name='gdata',
- version='1.3.4',
+ version='2.0.0',
description='Python client library for Google data APIs',
long_description = """\
The Google data Python client library makes it easy to interact with
42 src/gdata/client.py
View
@@ -26,7 +26,6 @@
GDClient: handles auth and CRUD operations when communicating with servers.
GDataClient: deprecated client for version one services. Will be removed.
- create_converter: uses a prototype object to create a converter function.
"""
@@ -36,24 +35,23 @@
import re
import atom.client
import atom.core
-import gdata.service
import atom.http_core
import gdata.gauth
import gdata.data
# Old imports
+import gdata.service
import urllib
import urlparse
import gdata.auth
-import atom.service
class Error(Exception):
pass
-class RequestError(gdata.service.RequestError):
+class RequestError(Error):
status = None
reason = None
body = None
@@ -64,7 +62,7 @@ class RedirectError(RequestError):
pass
-class CaptchaChallenge(gdata.service.CaptchaRequired):
+class CaptchaChallenge(RequestError):
captcha_url = None
captcha_token = None
@@ -77,7 +75,7 @@ class ClientLoginFailed(RequestError):
pass
-class UnableToUpgradeToken(Error):
+class UnableToUpgradeToken(RequestError):
pass
@@ -85,35 +83,12 @@ class Unauthorized(Error):
pass
-class BadAuthenticationServiceURL(RedirectError,
- gdata.service.BadAuthenticationServiceURL):
+class BadAuthenticationServiceURL(RedirectError):
pass
-def v2_entry_from_response(response):
- """Experimental converter which gets an Atom entry from the response."""
- return gdata.data.entry_from_string(response.read(), version=2)
-
-
-def v2_feed_from_response(response):
- """Experimental converter which gets an Atom feed from the response."""
- return gdata.data.feed_from_string(response.read(), version=2)
-
-
-def create_converter(obj):
- """Experimental: Generates a converter function for this object's class.
-
- When updating an entry, the returned object should usually be of the same
- type as the original entry. Since the client's request method takes a
- converter funtion as an argument, we need a function which will parse the
- XML using the desired class.
-
- Returns:
- A function which takes an XML string as the only parameter and returns an
- object of the same type as obj.
- """
- return lambda response: atom.core.parse(
- response.read(), obj.__class__, version=2, encoding='UTF-8')
+class BadAuthentication(RequestError):
+ pass
def error_from_response(message, http_response, error_class, response_body=None):
@@ -364,8 +339,7 @@ def request_client_login_token(self, email, password, source, service=None,
challenge.captcha_token = captcha_challenge['token']
raise challenge
elif response_body.splitlines()[0] == 'Error=BadAuthentication':
- raise gdata.service.BadAuthentication(
- 'Incorrect username or password')
+ raise BadAuthentication('Incorrect username or password')
else:
raise error_from_response('Server responded with a 403 code',
response, RequestError, response_body)
54 src/gdata/data.py
View
@@ -455,57 +455,3 @@ class FeedLink(atom.core.XmlElement):
read_only = 'readOnly'
count_hint = 'countHint'
href = 'href'
-
-
-# TODO: once atom Link exists, inherit from that.
-class Link(atom.core.XmlElement):
- _qname = '{http://www.w3.org/2005/Atom}link'
- rel = 'rel'
- href = 'href'
-
-
-# TODO: remove this once atom Entry and Feed exist.
-class FeedEntryParent(atom.core.XmlElement):
- etag = '{http://schemas.google.com/g/2005}etag'
- link = [Link]
-
- def find_url(self, rel):
- for link in self.link:
- if link.rel == rel and link.href:
- return link.href
- return None
-
-
-# TODO: once atom Entry exists, inherit from that.
-class GEntry(FeedEntryParent):
- _qname = '{http://www.w3.org/2005/Atom}entry'
-
- def get_edit_url(self):
- return self.find_url('edit')
-
- GetEditUrl = get_edit_url
-
-
-def entry_from_string(xml_string, version=1, encoding='UTF-8'):
- return atom.core.parse(xml_string, GEntry, version, encoding)
-
-
-EntryFromString = entry_from_string
-
-
-# TODO: once atom Feed exists, inherit from that.
-class GFeed(FeedEntryParent):
- _qname = '{http://www.w3.org/2005/Atom}feed'
- entry = [GEntry]
-
- def get_next_url(self):
- return self.find_url('next')
-
- GetNextUrl = get_next_url
-
-
-def feed_from_string(xml_string, version=1, encoding='UTF-8'):
- return atom.core.parse(xml_string, GFeed, version, encoding)
-
-
-FeedFromString = feed_from_string
21 tests/gdata_tests/client_test.py
View
@@ -56,7 +56,7 @@ def test_token_request(self):
# Test a 302 redirect from the server on a login request.
client.http_client.set_response(302, 'ignored', '', {})
# TODO: change the exception class to one in gdata.client.
- self.assertRaises(gdata.service.BadAuthenticationServiceURL,
+ self.assertRaises(gdata.client.BadAuthenticationServiceURL,
client.request_client_login_token, 'email', 'pw', '', '')
# Test a CAPTCHA challenge from the server
@@ -214,27 +214,15 @@ class TestClass(atom.core.XmlElement):
client = gdata.client.GDClient()
client.http_client = atom.mock_http_core.EchoHttpClient()
- test_entry = gdata.data.GEntry()
+ test_entry = gdata.data.GDEntry()
result = client.post(test_entry, 'http://example.com')
- self.assertTrue(isinstance(result, gdata.data.GEntry))
+ self.assertTrue(isinstance(result, gdata.data.GDEntry))
result = client.post(test_entry, 'http://example.com', converter=bad_converter)
self.assertEquals(result, 1)
result = client.post(test_entry, 'http://example.com', desired_class=TestClass)
self.assertTrue(isinstance(result, TestClass))
-class CreateConverterTest(unittest.TestCase):
-
- def test_create_converter(self):
- e = gdata.data.GEntry()
- fake_response = StringIO.StringIO(
- '<entry xmlns="http://www.w3.org/2005/Atom"><title>x</title></entry>')
- converter_function = gdata.client.create_converter(e)
- entry = converter_function(fake_response)
- self.assertTrue(isinstance(entry, gdata.data.GEntry))
- self.assertEqual(entry.get_elements('title')[0].text, 'x')
-
-
class QueryTest(unittest.TestCase):
def test_query_modifies_request(self):
@@ -340,8 +328,7 @@ def suite():
return unittest.TestSuite((unittest.makeSuite(ClientLoginTest, 'test'),
unittest.makeSuite(AuthSubTest, 'test'),
unittest.makeSuite(RequestTest, 'test'),
- unittest.makeSuite(QueryTest, 'test'),
- unittest.makeSuite(CreateConverterTest, 'test')))
+ unittest.makeSuite(QueryTest, 'test')))
if __name__ == '__main__':
25 tests/gdata_tests/data_test.py
View
@@ -26,6 +26,7 @@
from gdata import test_data
import gdata.test_config as conf
import atom.core
+import atom.data
SIMPLE_V2_FEED_TEST_DATA = """<feed xmlns='http://www.w3.org/2005/Atom'
@@ -380,14 +381,14 @@ def testCorrectFromStringType(self):
class SimpleV2FeedTest(unittest.TestCase):
def test_parsing_etags_and_edit_url(self):
- feed = gdata.data.feed_from_string(SIMPLE_V2_FEED_TEST_DATA)
+ feed = atom.core.parse(SIMPLE_V2_FEED_TEST_DATA, gdata.data.GDFeed)
# General parsing assertions.
self.assertEqual(feed.get_elements('title')[0].text,
'Elizabeth Bennet\'s Contacts')
self.assertEqual(len(feed.entry), 2)
for entry in feed.entry:
- self.assertTrue(isinstance(entry, gdata.data.GEntry))
+ self.assertTrue(isinstance(entry, gdata.data.GDEntry))
self.assertEqual(feed.entry[0].GetElements('title')[0].text,
'Fitzwilliam')
self.assertEqual(feed.entry[0].get_elements('id')[0].text,
@@ -399,31 +400,31 @@ def test_parsing_etags_and_edit_url(self):
self.assertEqual(feed.entry[1].etag, '"123456"')
# Look for Edit URLs.
- self.assertEqual(feed.entry[0].get_edit_url(),
+ self.assertEqual(feed.entry[0].find_edit_link(),
'http://www.google.com/m8/feeds/contacts/liz%40gmail.com/full/c9e')
- self.assertEqual(feed.entry[1].GetEditUrl(), 'http://example.com/1')
+ self.assertEqual(feed.entry[1].FindEditLink(), 'http://example.com/1')
# Look for Next URLs.
- self.assertEqual(feed.get_next_url(),
+ self.assertEqual(feed.find_next_link(),
'http://www.google.com/m8/feeds/contacts/.../more')
def test_constructor_defauls(self):
- feed = gdata.data.GFeed()
+ feed = gdata.data.GDFeed()
self.assertTrue(feed.etag is None)
self.assertEqual(feed.link, [])
self.assertEqual(feed.entry, [])
- entry = gdata.data.GEntry()
+ entry = gdata.data.GDEntry()
self.assertTrue(entry.etag is None)
self.assertEqual(entry.link, [])
- link = gdata.data.Link()
+ link = atom.data.Link()
self.assertTrue(link.href is None)
self.assertTrue(link.rel is None)
- link1 = gdata.data.Link(href='http://example.com', rel='test')
+ link1 = atom.data.Link(href='http://example.com', rel='test')
self.assertEqual(link1.href, 'http://example.com')
self.assertEqual(link1.rel, 'test')
- link2 = gdata.data.Link(href='http://example.org/', rel='alternate')
- entry = gdata.data.GEntry(etag='foo', link=[link1, link2])
- feed = gdata.data.GFeed(etag='12345', entry=[entry])
+ link2 = atom.data.Link(href='http://example.org/', rel='alternate')
+ entry = gdata.data.GDEntry(etag='foo', link=[link1, link2])
+ feed = gdata.data.GDFeed(etag='12345', entry=[entry])
self.assertEqual(feed.etag, '12345')
self.assertEqual(len(feed.entry), 1)
self.assertEqual(feed.entry[0].etag, 'foo')
Please sign in to comment.
Something went wrong with that request. Please try again.