Last active
June 29, 2017 05:37
-
-
Save yatt/8558349 to your computer and use it in GitHub Desktop.
スターバックスカードの残高確認スクリプト
This file contains 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
# coding: utf-8 | |
# スタバカードの残金を取得する。 | |
import urllib | |
import re | |
cardno,pin = open('credentials.txt').read().split() | |
# HTML | |
params = urllib.urlencode({'sbCardNumber': cardno, 'pinNumber': pin}) | |
content = urllib.urlopen('https://card.starbucks.co.jp/mystarbucks/card/inquire/complete', params).read() | |
content = unicode(content, 'utf-8') | |
# 残高の取得 | |
balance = re.findall(ur'(\d[,\d]*) 円', content)[0] | |
balance = int(balance.replace(',')) | |
print balance | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment