Skip to content

Instantly share code, notes, and snippets.

@kaave
Created September 20, 2016 13:27
Show Gist options
  • Save kaave/3a3b1d5da62bb2a1ccbd5c0740281cfb to your computer and use it in GitHub Desktop.
Save kaave/3a3b1d5da62bb2a1ccbd5c0740281cfb to your computer and use it in GitHub Desktop.
Add Get method to Felica reader sample code
def show_tag(self, tag):
# print tags
print(tag)
# create url values
url_values = urllib.urlencode({"read": tag})
# create request url
url = "http://localhost:8000/?" + url_values
print(" Request to: " + url)
try:
res = urllib2.urlopen(url)
# output result
if res.code == 200:
print(' Success! msg: ' + res.msg)
else:
raise(' Fail! code: ' + str(res.code) + ', msg: ' + res.msg)
except:
print(" Unknown error: ", sys.exc_info()[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment