如何访问家庭银行?使用Post和httplib



我的目标是访问我的家庭银行业务以控制费用。问题是我总是得到一个代码302,可能是因为我发送了一个错误的用户和密钥。以下是否是用邮政SSL发送头部的正确方法?

import httplib
host = 'www.bancoprovincia.bancainternet.com.ar'
conn = httplib.HTTPSConnection(host)
conn.set_debuglevel(1)
conn.putrequest("POST", "/eBanking/login")
header = {'accept-Language': 'es-ES,es;q=0.8,en;q=0.6', 
'accept-Encoding': 'gzip,deflate,sdch', 'content-Type': 
'application/x-www-form-urlencoded', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}
for k, v in header.iteritems():
    conn.putheader(k, v)
user = '##'
passwd = '##'
conn.endheaders()
conn.send('usuario:'+user+'clave:'+passwd)
res = conn.getresponse()
print res.status
print res.getheaders()

这是来自服务器的响应

send: 'POST /eBanking/login HTTP/1.1rnHost: www.bancoprovincia.bancainternet.com.arrnAccept-Encoding: identityrncontent-Type: application/x-www-form-urlencodedrnaccept-Language: es-ES,es;q=0.8,en;q=0.6rnaccept-Encoding: gzip,deflate,sdchrnaccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8rnuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36rnrn'
send: 'usuario:##:clave##'
reply: 'HTTP/1.1 302 Movido temporxe1lmentern'
header: Date: Wed, 12 Feb 2014 19:40:18 GMT
header: Server: Apache/2.2.17 (Red Hat Enterprise Web Server)
header: Set-Cookie: JSESSIONID=696BA6EB7C85B74476817A42C211ED29.tcc1; Path=/eBanking; Secure
header: Location: https://www.bancoprovincia.bancainternet.com.ar/eBanking/login/inicio.htm;jsessionid=696BA6EB7C85B74476817A42C211ED29.tcc1?login_error=1
header: Content-Length: 0
header: Connection: close
header: Content-Type: text/plain; charset=UTF-8
302

看到响应中的位置标头了吗?服务器告诉您应该使用该 URI有关详细信息,请参阅 http 状态代码

最新更新