Skip to content

Instantly share code, notes, and snippets.

@stavlor
Last active June 27, 2018 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stavlor/9e3350b50be3d87f4f973ae47b4b1170 to your computer and use it in GitHub Desktop.
Save stavlor/9e3350b50be3d87f4f973ae47b4b1170 to your computer and use it in GitHub Desktop.
def add_database_entry(bid, duration, location, starttime, app):
import urllib
import requests
log = logging.getLogger(name="AddDBEntry")
data = {'bid': bid, 'dtime': starttime, 'dur': duration, 'quality': 'HQ', 'path': location, 'application': app}
url = "http://bcgbe_prd.tnsmi-cmr.com/BeavService/InsertSybase.aspx?" + urllib.parse.urlencode(data)
try:
result = requests.get(url)
except:
log.debug('Exception Encountered in Database add!!')
send_mail("Exception in add_database_entry!!!" + str(
sys.exc_info()) + " Likely no Database entry made for this recording!!.", "Error in add_database_entry!!")
log.debug("URL:" + str(url))
log.debug('Result' + str(result.content))
return bool(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment