Created
September 20, 2016 13:27
-
-
Save kaave/3a3b1d5da62bb2a1ccbd5c0740281cfb to your computer and use it in GitHub Desktop.
Add Get method to Felica reader sample code
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
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