输入银行卡号查询发卡行执行代码-立哥开发

#Copy Right by Jacky Zong . Vision 1.5
from bs4 import BeautifulSoup
import urllib2
import json

ALI_BANKS = ‘http://ab.alipay.com/i/yinhang.htm’

try:
response = urllib2.urlopen(ALI_BANKS)
except urllib2.HTTPError, e:
print “HTTP Error %s : %s” % (e.code, e.reason)
system.exit(1)
except urllib2.URLError, e:
print “Unable to connect the remote server.”
system.exit(1)

content = response.read()

soup = BeautifulSoup(content)
spans = soup.find_all(“span”, class_=“icon”)

banks = {}

for span in spans:

banks[span[‘class’][1]] = span.text

banks = { span[‘class’][1] : span.text for span in spans }

print json.dumps(banks, ensure_ascii=False, indent=2)
print “total : %d” % len(banks)

Connection: keep-alive
Content-Language: zh-CN
Content-Length: 101
Content-Type: application/json;charset=GBK
Date: Sun, 08 Mar 2015 15:21:17 GMT
Server: spanner/1.0.6
Set-Cookie: JSESSIONID=CCDE8AA9E2DAEC082A7614734AF729FB; Path=/; HttpOnly
Set-Cookie: JSESSIONID=CCDE8AA9E2DAEC082A7614734AF729FB; Path=; Secure; HttpOnly
Set-Cookie: spanner=dauWw2JHEhbWoKV/zrMf2LLFCxFf8h1G;path=/;secure;
Strict-Transport-Security: max-age=31536000

{
“bank”: “Citi Bank”,
“cardType”: “DC”,
“key”: “622843012000000XXXXX”,
“messages”: [],
“stat”: “ok”,
“validated”: true
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值