From c968a57d73119fd71c4bbef80b7c55b2a1878e07 Mon Sep 17 00:00:00 2001 From: Joe Gregorio Date: Tue, 5 Apr 2011 10:00:43 -0400 Subject: [PATCH] Removing OAuth 2.0 Latitude sample. --- samples/oauth2/latitude/latitude.py | 59 ----------------------------- 1 file changed, 59 deletions(-) delete mode 100644 samples/oauth2/latitude/latitude.py diff --git a/samples/oauth2/latitude/latitude.py b/samples/oauth2/latitude/latitude.py deleted file mode 100644 index b712066..0000000 --- a/samples/oauth2/latitude/latitude.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/python2.4 -# -*- coding: utf-8 -*- -# -# Copyright 2010 Google Inc. All Rights Reserved. - -"""Simple command-line example for Latitude. - -Command-line application that sets the users -current location. -""" - -__author__ = 'jcgregorio@google.com (Joe Gregorio)' - -import httplib2 - -from apiclient.discovery import build -from oauth2client.file import Storage -from oauth2client.client import OAuth2WebServerFlow -from oauth2client.tools import run -from apiclient.oauth import CredentialsInvalidError - -# Uncomment to get detailed logging -#httplib2.debuglevel = 4 - - -def main(): - storage = Storage('latitude.dat') - credentials = storage.get() - if credentials is None or credentials.invalid: - flow = OAuth2WebServerFlow( - client_id='433807057907.apps.googleusercontent.com', - client_secret='jigtZpMApkRxncxikFpR+SFg', - scope='https://www.googleapis.com/auth/latitude', - user_agent='latitude-cmdline-sample/1.0') - - credentials = run(flow, storage) - - http = httplib2.Http() - http = credentials.authorize(http) - - service = build("latitude", "v1", http=http) - - body = { - "data": { - "kind": "latitude#location", - "latitude": 37.420352, - "longitude": -122.083389, - "accuracy": 130, - "altitude": 35 - } - } - try: - print service.currentLocation().insert(body=body).execute() - except CredentialsInvalidError: - print 'Your credentials are no longer valid.' - print 'Please re-run this application to re-authorize.' - -if __name__ == '__main__': - main()