2
# -*- coding: utf-8 -*-
4
# Copyright (C) 2012 Google Inc.
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
18
"""Simple command-line example for Latitude.
20
Command-line application that sets the users
26
You can also get help on all the command-line flags the program understands
29
$ python latitude.py --help
31
To get detailed log output run:
33
$ python latitude.py --logging_level=DEBUG
36
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
40
from oauth2client import client
41
from apiclient import sample_tools
44
service, flags = sample_tools.init(
45
argv, 'latitude', 'v1', __doc__, __file__,
46
scope='https://www.googleapis.com/auth/latitude.all.best')
51
"kind": "latitude#location",
52
"latitude": 37.420352,
53
"longitude": -122.083389,
59
print service.currentLocation().insert(body=body).execute()
61
except client.AccessTokenRefreshError:
62
print ("The credentials have been revoked or expired, please re-run"
63
"the application to re-authorize")
65
if __name__ == '__main__':