python requests quic

Python Requests Quic

If you are working with python and need to make HTTP requests, then the python requests library is an excellent choice. It is easy to use and provides a lot of functionality out of the box. However, there may be times when you need to use a different protocol than HTTP, such as QUIC. In this case, you can use the python requests-quic library.

What is QUIC?

QUIC stands for Quick UDP Internet Connections. It is a new protocol developed by Google that aims to improve upon the performance of TCP and TLS. QUIC is designed to reduce latency and improve security by combining the functionality of both protocols into a single protocol.

How to use Python Requests Quic Library?

To use the python requests-quic library, you first need to install it using pip:

pip install http3

Once you have installed the library, you can use it in your code by importing the HTTP3Adapter class from the http3 module:

import requests
from http3 import HTTP3Adapter

# create a session
session = requests.Session()

# create an HTTP3Adapter instance
http3_adapter = HTTP3Adapter()

# mount the adapter to the session
session.mount('https://', http3_adapter)

# make a request
response = session.get('')

In this example, we create a new session object and an instance of the HTTP3Adapter class. We then mount the adapter to the session object using the mount() method. Finally, we make a GET request using the get() method and pass in the URL we want to retrieve.

You can also specify additional parameters when creating the HTTP3Adapter instance to customize the behavior of the adapter. For example, you can specify the maximum number of retries, the timeout period, and whether to verify SSL certificates:

http3_adapter = HTTP3Adapter(max_retries=3, timeout=10.0, verify=False)

By default, the python requests-quic library uses the h3-29 version of the QUIC protocol. However, you can specify a different version by passing in the appropriate value for the version parameter:

http3_adapter = HTTP3Adapter(version='h3-23')


The python requests-quic library provides an easy way to make HTTP requests using the QUIC protocol. By using this library, you can take advantage of the benefits of QUIC, such as reduced latency and improved security. If you are working with python and need to make HTTP requests over QUIC, then the python requests-quic library is definitely worth considering.