In [1]:
import requests

In [2]:
local_filename="cds.sql"
url="http://hgdownload.soe.ucsc.edu/goldenPath/hg38/database/cds.sql"
r = requests.get(url, stream=True)
with open(local_filename, 'wb') as f:
    for chunk in r.iter_content(chunk_size=1024*1024): 
        if chunk:
            f.write(chunk)

In [4]:
with open(local_filename, 'r') as infile:
    for line in infile.readlines():
        print line


-- MySQL dump 10.13  Distrib 5.6.26, for Linux (x86_64)

--

-- Host: localhost    Database: hg38

-- ------------------------------------------------------

-- Server version	5.6.26



/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

/*!40101 SET NAMES utf8 */;

/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;

/*!40103 SET TIME_ZONE='+00:00' */;

/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */;

/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;



--

-- Table structure for table `cds`

--



DROP TABLE IF EXISTS `cds`;

/*!40101 SET @saved_cs_client     = @@character_set_client */;

/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `cds` (

  `id` int(11) NOT NULL,

  `name` longtext NOT NULL,

  `crc` int(10) unsigned NOT NULL,

  PRIMARY KEY (`id`),

  KEY `name` (`name`(32)),

  KEY `crc` (`crc`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

/*!40101 SET character_set_client = @saved_cs_client */;



/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;



/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;

/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;



-- Dump completed on 2016-04-03  6:56:09


In [ ]: