Created
June 26, 2009 23:09
-
-
Save tannerburson/136812 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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