blob: 492300c708f50d3bbe6605dab46a79951aea8d69 [file] [log] [blame]
Joe Gregorio0802a172010-10-26 16:23:00 -04001#!/usr/bin/python2.4
2# -*- coding: utf-8 -*-
3#
4# Copyright 2010 Google Inc. All Rights Reserved.
5
6"""Simple command-line example for Latitude.
7
8Command-line application that sets the users
9current location.
10"""
11
12__author__ = 'jcgregorio@google.com (Joe Gregorio)'
13
14
15from apiclient.discovery import build
16
17import httplib2
18import pickle
19
20# Uncomment to get detailed logging
21# httplib2.debuglevel = 4
22
23def main():
24 f = open("latitude.dat", "r")
25 credentials = pickle.loads(f.read())
26 f.close()
27
28 http = httplib2.Http()
29 http = credentials.authorize(http)
30
31 p = build("latitude", "v1", http=http)
32
33 body = {
34 "data": {
35 "kind":"latitude#location",
36 "latitude":37.420352,
37 "longitude":-122.083389,
38 "accuracy":130,
39 "altitude":35
40 }
41 }
42 print p.currentLocation().insert(body=body).execute()
43
44if __name__ == '__main__':
45 main()