sydney python presentation (feb 2010) - tracking large metallic objects / google app engine
DESCRIPTION
In this presentation I give an overview of hacking Google Latitude and Google App Engine to track "friends".TRANSCRIPT
![Page 1: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/1.jpg)
Tracking large metallic objects using App Engine and Latitude
Kelvin Nicholson
![Page 2: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/2.jpg)
Creative Opportunities Abound
![Page 3: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/3.jpg)
![Page 4: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/4.jpg)
Python
![Page 5: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/5.jpg)
An idea is born
+ +
![Page 6: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/6.jpg)
General Workflow
HTTP Post over 3G
Parse POST Data (XML)
Verify Location in NSW
Get OAuth Credentials for “user”
Post Location to Latitude API
![Page 7: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/7.jpg)
General Workflow 2
class RawXml(db.Model): # storage model for raw GPS data
content = db.TextProperty()
class MainHandler(webapp.RequestHandler): # do stuff
def get(self):
self.response.out.write('OK')
def post(self):
content = self.request.body
rawXmlObject = RawXml(content = str(content))
rawXmlObject.put()
![Page 8: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/8.jpg)
General Workflow 2
<gpsid=“metalObject"><coordinates><coordinate><fix>3D</fix><time>0</time><latitude>-33.867275</latitude><longitude>151.206964</longitude><altitude>80.000000</altitude><climb>0.000000</climb><speed>25.000000</speed><separation>0.000000</separation><track>0.000000</track><satellites>8</satellites></coordinate></coordinates></gps>
![Page 9: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/9.jpg)
General Workflow 3
![Page 10: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/10.jpg)
OAuth Issues
• Most issues occurred after adding 2nd “object”
• Like forgetting to create the OAuth token
• Or incorrectly storing credentials (one StorageByKeyName name, two credentials, doesn’t work)
• And forgetting to enable the Latitude API
• And this: Failed to retrieve access token: { "error" : "invalid_grant" }
![Page 11: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/11.jpg)
Metallic Object Map
![Page 12: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/12.jpg)
Lessons Learned
• OAuth is sometimes like a nightmare
– Understand the different OAuth scenarios
• Always use the latest library
• AppEngine Quota limit - small writes to datastore are a killer
• Adding a second Object feed broke everything
• This little hack actually came in useful
• But… Python was always fun!
![Page 13: Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Google App Engine](https://reader033.vdocuments.net/reader033/viewer/2022052911/559dee951a28ab43468b4612/html5/thumbnails/13.jpg)
Thank You
• Questions?