I tried, 2 methods to download an XML file:
import requests
from tqdm import tqdm
url = "http://software.broadinstitute.org/gsea/msigdb/download_file.jsp?filePath=/resources/msigdb/6.2/msigdb_v6.2.xml"
response = requests.get(url, stream=True)
with open("lol.xml", "wb") as handle:
for data in tqdm(response.iter_content()):
handle.write(data)
and the second one:
import urllib2
response = urllib2.urlopen(url)
data = response.read()
print(data)
It turns out, that I only download the html file and not the xml file, an code snippet of the output:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="http://software.broadinstitute.org/gsea/" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="verify-v1" content="/23Jlayki9tnRqU7DcCYrbFI7zPmHJ3HfeZltM6mK5Q=" />
<title>GSEA | Login</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
How to download the XML file?
Aucun commentaire:
Enregistrer un commentaire