I need to retrieve a JavaScript file content with Python. I thought that maybe requests would do the trick - perhaps it does but it's either not as straightforward as I thought or I'm doing something wrong.
import requests
s = requests.Session()
r = s.get(link)
The response I get is
<HTML><HEAD>
<TITLE>Invalid URL</TITLE>
</HEAD><BODY>
<H1>Invalid URL</H1>
The requested URL "[no URL]", is invalid.<p>
Reference #9.3e1151c8.1484072058.308a223a
</BODY></HTML>
What I need it's the same that what this code does in php,
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $link);
$html = curl_exec($ch);