用python下载亲爱的注释文件
我想下载一个affymetrix注释文件。 但它需要先登录。
登录页面是https://www.affymetrix.com/estore/user/login.jsp我要下载的文件是:http://www.affymetrix.com/Auth/analysis/downloads/na32/genotyping/ GenomeWideSNP_6.na32.annot.db.zip
我尝试了一些方法,但我无法弄清楚。
#from requests import session payload = { 'action': 'login', 'username': 'username', #This part should be changed 'password': 'password' #This part should be changed } with session() as c: c.post('https://www.affymetrix.com/estore/user/login.jsp', data=payload) request = c.get('http://www.affymetrix.com/Auth/analysis/downloads/na32/genotyping/GenomeWideSNP_6.na32.annot.db.zip') print request.headers print request.text#
我也尝试urllib2,
import urllib, urllib2, cookielib username = 'username' password = 'password' cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) login_data = urllib.urlencode({'username' : username, 'password' : password}) opener.open('https://www.affymetrix.com/estore/user/login.jsp', login_data) resp = opener.open('http://www.affymetrix.com/Auth/analysis/downloads/na32/genotyping/GenomeWideSNP_6.na32.annot.db.zip') resp.read()
这是信息发布到的URL。
https://www.affymetrix.com/estore/user/login.jsp?_DARGS=/estore/user/login.jsp
这里是正在发布的信息。
链接地址: http://www.djcxy.com/p/22737.html上一篇: Download affy annotation file with python
下一篇: How to sort a m x n matrix which has all its m rows sorted and n columns sorted?