Skip to content

Instantly share code, notes, and snippets.

@tannerburson
Created June 26, 2009 23:09
Show Gist options
  • Select an option

  • Save tannerburson/136812 to your computer and use it in GitHub Desktop.

Select an option

Save tannerburson/136812 to your computer and use it in GitHub Desktop.
import android
import httplib
import urllib
while(True):
droid = android.Android()
code = droid.scanBarcode()
isbn = code['result']['SCAN_RESULT']
sleep(5)
if not isbn: # Scan failed for some reason, bail.
print "\r\n SCAN FAILED \r\n"
sleep(3000)
break
conn = httplib.HTTPConnection("YOUR_SERVER_NAME_HERE")
conn.request("GET", "add_isbn.php?" + urllib.urlencode({'isbn': isbn }))
resp = conn.getresponse()
print resp.read() + "\r\n"
conn.close()
droid.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment