HTTPS: Difference between revisions

547 bytes removed ,  3 years ago
Python 2 has reached end of life. Removed external library as is meant to be demonstration of native language capability.
(Fixed whitespace and JSLint validated.)
(Python 2 has reached end of life. Removed external library as is meant to be demonstration of native language capability.)
Line 619:
 
=={{header|Python}}==
Python's '''urllib.request''' library, ('''urllib2''' in Python2.x) has support for SSL if the interpreter's underlying ''httplib'' libraries were compiled with SSL support. By default this will be the enabled for default Python installations on most platforms.
<lang Python>from urllib.request import urlopen
 
print(urlopen('https://sourceforge.net/').read())</lang>
Python 3.x:
<lang Python>
from urllib.request import urlopen
print(urlopen('https://sourceforge.net/').read())
</lang>
 
(Python 2.x)
<lang Python>
from urllib2 import urlopen
print urlopen('https://sourceforge.net/').read()
</lang>
 
 
{{libheader|Requests}}
{{works with|Python|2.7, 3.4–3.7}}
From the Requests documentation: ''"Requests verifies SSL certificates for HTTPS requests, just like a web browser. By default, SSL verification is enabled, and Requests will throw a SSLError if it’s unable to verify the certificate"''
<lang Python>
import requests
print(requests.get("https://sourceforge.net").text)
</lang>
 
=={{header|R}}==