Last active
February 23, 2016 14:52
-
-
Save rishi93/5901c77284eafddc8d9a to your computer and use it in GitHub Desktop.
rfid shopping basket
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
from urllib import urlopen | |
url = "http://data.sparkfun.com/input/7JAm8EYLolf0yYZ2xolq?private_key=mzVy8NMJp4TyX1j0mVRK&rfid_code=" #GET request | |
def checkIfAlreadyPresent(arr,item): | |
for i in arr: | |
if item == i: | |
return True | |
return False | |
arr = [] | |
done = False | |
while(not done): | |
item = int(input("Enter item code")) | |
if item == -1: | |
done = True | |
for i in arr: | |
sendResponse = url + str(i) | |
result = urlopen(sendResponse).read() | |
print(result) | |
break | |
if(checkIfAlreadyPresent(arr,item)): | |
arr.remove(item) | |
else: | |
arr.append(item) | |
print(arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment