how to send this raw request using python '''GET https://google.com HTTP/2 host:…
- User
how to send this raw request using python
'''GET https://google.com HTTP/2 host: https://google.com'''
- Assistant
To send a raw HTTP request in Python, particularly with specifying the HTTP version such as HTTP/2, you need a library that supports HTTP/2. One such library is
httpx, which has support for HTTP/2. The defaultrequestslibrary in Python does not support HTTP/2.First, ensure you have
httpxinstalled. You can install it using pip:bashpip install httpx[http2]Once
httpxis installed, you can send a GET request tohttps://google.comwith HTTP/2 like this:python - User
what about this request '''GET https://yandex.com/ HTTP/1.1 host: yandex.com upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7 sec-fetch-site: same-origin sec-fetch-mode: navigate sec-fetch-user: ?1 sec-fetch-dest: document sec-ch-ua: "Chromium";v="123", "Not:A-Brand";v="8" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" referer: https://yandex.com/ accept-encoding: gzip, deflate, br, zstd accept-language: en-US,en;q=0.9'''
- Assistant
- User
no, use httpx and send this RAW request. just 1 string
- Assistant