Downloading a song through python-requests
<p>I was trying to make a script to download songs from internet. I was first trying to download the song by using "requests" library. But I was unable to play the song. Then, I did the same using "urllib2" library and I was able to play the song this time.</p>

<p>Can't we use "requests" library to download songs? If yes, how?</p>

<p>Code by using requests:</p>

<pre><code>import requests
doc = requests.get("http://gaana99.com/fileDownload/Songs/0/28768.mp3")
f = open("movie.mp3","wb")
f.write(doc.text)
f.close()
</code></pre>

<p>Code by using urllib2:</p>

<pre><code>import urllib2
mp3file = urllib2.urlopen("http://gaana99.com/fileDownload/Songs/0/28768.mp3")
output = open('test.mp3','wb')
output.write(mp3file.read())
output.close()
</code></pre>