db_check.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 def db_check(msg):
00004 
00005     try:
00006         import requests
00007     except ImportError, e:
00008         print str(e), ", skipping db_check."
00009         # Since failure of db_check does not mean the installability checking failed,
00010         # return true here so as not to effect the other checking steps.
00011         return True
00012 
00013     url = 'https://docs.google.com/forms/d/1FuvFIWQui1dawi9OtPgEo4Q6V729hkhjfRetJKtId3Q/formResponse'
00014     form_data = {'entry.1561122805':msg}
00015     user_agent = {'Referer':'https://docs.google.com/forms/d/1FuvFIWQui1dawi9OtPgEo4Q6V729hkhjfRetJKtId3Q/viewform','User-Agent': "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36"}
00016 
00017     print "\n* Saving DB..\n"
00018     try:
00019         r = requests.post(url, data=form_data, headers=user_agent)
00020     # Using Python 2.5 style. See http://stackoverflow.com/questions/5119751/in-python-whats-the-difference-between-except-exception-as-e-and-except-exc
00021     except Exception, e:
00022         print "".join(map(lambda s: hex(s), [ord(s) for s in e.message.message]))
00023         return False
00024     if not r.ok:
00025         print "  ... Could not find internet connection"
00026     return r.ok
00027 
00028 
00029 


hironx_ros_bridge
Author(s): Kei Okada
autogenerated on Mon Oct 6 2014 07:19:42