Cleaning up 2.7 compatibility and more work on installer.

This commit is contained in:
Joe Gregorio
2011-03-25 15:03:10 -04:00
parent 01b9270815
commit 06d852bb21
9 changed files with 15 additions and 12 deletions

View File

@@ -1,10 +1,12 @@
recursive-include tests *.py *.json recursive-include tests *.py *.json
recursive-include functional_tests *.py *.json
recursive-include httplib2 *.py *.json recursive-include httplib2 *.py *.json
recursive-include uritemplate *.py *.json recursive-include uritemplate *.py *.json
recursive-include apiclient *.json *.py recursive-include apiclient *.json *.py
recursive-include docs *.html recursive-include docs *.html
recursive-include samples *.py *.png *.html *.yaml *.json recursive-include samples *.py *.png *.html *.yaml *.json
include runtests.py include runtests.py
include runsamples.py
include setpath.sh include setpath.sh
include setup_utils.py include setup_utils.py
include gflags.py include gflags.py

View File

@@ -48,7 +48,8 @@ DISCOVERY_URI = ('https://www.googleapis.com/discovery/v0.3/describe/'
DEFAULT_METHOD_DOC = 'A description of how to use this function' DEFAULT_METHOD_DOC = 'A description of how to use this function'
# Query parameters that work, but don't appear in discovery # Query parameters that work, but don't appear in discovery
STACK_QUERY_PARAMETERS = ['trace', 'fields', 'pp', 'prettyPrint', 'userIp', 'strict'] STACK_QUERY_PARAMETERS = ['trace', 'fields', 'pp', 'prettyPrint', 'userIp',
'strict']
def key2param(key): def key2param(key):

View File

@@ -299,9 +299,9 @@ def tunnel_patch(http):
if headers is None: if headers is None:
headers = {} headers = {}
if method == 'PATCH': if method == 'PATCH':
if 'authorization' in headers and 'oauth_token' in headers['authorization']: if 'oauth_token' in headers.get('authorization', ''):
logging.warning( logging.warning(
'OAuth 1.0 request made with Credentials applied after tunnel_patch.') 'OAuth 1.0 request made with Credentials after tunnel_patch.')
headers['x-http-method-override'] = "PATCH" headers['x-http-method-override'] = "PATCH"
method = 'POST' method = 'POST'
resp, content = request_orig(uri, method, body, headers, resp, content = request_orig(uri, method, body, headers,

View File

@@ -87,7 +87,7 @@ class Storage(object):
"""Retrieve credential. """Retrieve credential.
Returns: Returns:
apiclient.oauth.Credentials oauth2client.client.Credentials
""" """
_abstract() _abstract()

View File

@@ -30,7 +30,7 @@ import socket
import sys import sys
from optparse import OptionParser from optparse import OptionParser
from apiclient.oauth import RequestError from client import FlowExchangeError
try: try:
from urlparse import parse_qsl from urlparse import parse_qsl
@@ -140,7 +140,7 @@ def run(flow, storage):
try: try:
credentials = flow.step2_exchange(code) credentials = flow.step2_exchange(code)
except RequestError: except FlowExchangeError:
sys.exit('The authentication has failed.') sys.exit('The authentication has failed.')
storage.put(credentials) storage.put(credentials)

View File

@@ -24,8 +24,8 @@ def index(request):
credential = storage.get() credential = storage.get()
if credential is None or credential.invalid == True: if credential is None or credential.invalid == True:
flow = OAuth2WebServerFlow( flow = OAuth2WebServerFlow(
client_id='837647042410.apps.googleusercontent.com', client_id='887851474342.apps.googleusercontent.com',
client_secret='+SWwMCL9d8gWtzPRa1lXw5R8', client_secret='6V9MHBUQqOQtxI7uXPIEnV8e',
scope='https://www.googleapis.com/auth/buzz', scope='https://www.googleapis.com/auth/buzz',
user_agent='buzz-django-sample/1.0', user_agent='buzz-django-sample/1.0',
) )

View File

@@ -62,6 +62,7 @@ MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
) )
ROOT_URLCONF = 'django_sample.urls' ROOT_URLCONF = 'django_sample.urls'

View File

@@ -4,7 +4,7 @@
<p>Your username and password didn't match. Please try again.</p> <p>Your username and password didn't match. Please try again.</p>
{% endif %} {% endif %}
<form method="post" action="{% url django.contrib.auth.views.login %}"> <form method="post" action="{% url django.contrib.auth.views.login %}">{% csrf_token %}
<table> <table>
<tr> <tr>
<td>{{ form.username.label_tag }}</td> <td>{{ form.username.label_tag }}</td>

View File

@@ -34,7 +34,7 @@ packages = [
] ]
py_modules = [] py_modules = []
third_party_packages = ['httplib2'] third_party_packages = ['httplib2', 'oauth2']
third_party_modules = ['gflags', 'gflags_validators'] third_party_modules = ['gflags', 'gflags_validators']
# Don't clobber installed versions of third party libraries # Don't clobber installed versions of third party libraries
@@ -52,7 +52,7 @@ long_desc = """The Google API Client for Python is a client library for
accessing the Buzz, Moderator, and Latitude APIs.""" accessing the Buzz, Moderator, and Latitude APIs."""
setup(name="google-api-python-client", setup(name="google-api-python-client",
version="1.0alpha5", version="1.0alpha6",
description="Google API Client Library for Python", description="Google API Client Library for Python",
long_description=long_desc, long_description=long_desc,
author="Joe Gregorio", author="Joe Gregorio",
@@ -64,7 +64,6 @@ setup(name="google-api-python-client",
'apiclient': ['contrib/*/*.json'] 'apiclient': ['contrib/*/*.json']
}, },
license="Apache 2.0", license="Apache 2.0",
install_requires = ['python-gflags', 'oauth2'],
keywords="google api client", keywords="google api client",
classifiers=['Development Status :: 3 - Alpha', classifiers=['Development Status :: 3 - Alpha',
'Intended Audience :: Developers', 'Intended Audience :: Developers',