Python equivalent of `curl -v http://example.com/`

Python equivalent of `curl -v http://example.com/`

I've been experimenting with different Python modules such as pycurl and requests but still unable to get curl -v <URL> output as shown below.

I've been experimenting with different Python modules such as pycurl and requests but still unable to get curl -v <URL> output as shown below.

DESIRED OUTPUT (In Python code)

C:\>curl -v http://example.com/
*   Trying 93.184.216.34...
* TCP_NODELAY set
* Connected to example.com (93.184.216.34) port 80 (#0)
> GET / HTTP/1.1
> Host: example.com
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Cache-Control: max-age=604800
< Content-Type: text/html; charset=UTF-8
< Date: Mon, 21 Jan 2019 00:34:32 GMT
< Etag: "1337+ident"
< Expires: Mon, 28 Jan 2019 00:34:32 GMT
< Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
< Server: ECS (sjc/4E29)
< Vary: Accept-Encoding
< X-Cache: HIT
< Content-Length: 1270
<
<!doctype html>
<html>
... input truncated ...
</html>
* Curl_http_done: called premature == 0
* Connection #0 to host example.com left intact

C:&gt;

Since this is in Windows, I don't want to use os.system and subprocess modules as curl.exe is not there by default.

Here are my attempts ... But I still did not get similar output as produced by curl -v

>>> import requests
>>> requests.get("http://example.com").content
>>> requests.get("http://example.com").text

>>> import pycurl
>>> c = pycurl.Curl()
>>> c.setopt(c.URL, 'http://example.com') >>> c.perform()


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Top Python Development Companies | Hire Python Developers

After analyzing clients and market requirements, TopDevelopers has come up with the list of the best Python service providers. These top-rated Python developers are widely appreciated for their professionalism in handling diverse projects. When...

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3

Guide to Python Programming Language

Guide to Python Programming Language