Skip to content

Instantly share code, notes, and snippets.

@yatt
Last active June 29, 2017 05:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yatt/8558349 to your computer and use it in GitHub Desktop.
Save yatt/8558349 to your computer and use it in GitHub Desktop.
スターバックスカードの残高確認スクリプト
# 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