Package: ja3requests
Ja3RequestsJa3Requestsis a http request library that can customize ja3 or h2 fingerprints.中文文档>>>importja3requests>>>session=ja3requests.Session()>>>response=session.get("http://www.baidu.com/")>>>response<Response [200]>>>>response.status_code200>>>response.headers{'Content-Length': '405968', 'Content-Type': 'text/html; charset=utf-8', 'Server': 'BWS/1.1', 'Vary': 'Accept-Encoding', 'X-Ua-Compatible': 'IE=Edge,chrome=1', ...}>>>response.text'<!DOCTYPE html><!--STATUS OK--><html><head><meta http-equiv="Content-Type" content="text/html;char...'Ja3Requests currently implements only the HTTP protocol and a few methods.Installing Ja3Requests and Supported VersionsJa3Requests is available on PyPI:$python-mpipinstallja3requestsJa3Requests officially supports Python 3.7+.How To UseUnreasonable Request MethodJa3Requests supports multiple request methods such as Get, Post, Put, Delete, etc.importja3requestssession=ja3requests.session()# Getsession.get("http://example.com/")# POSTsession.post("http://example.com/")...Use The Headers Attributeimportja3requestsheaders={"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Host":"example.com","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0"}session=ja3requests.session()response=session.get("http://example.com/",headers=headers)print(response)Use The Params Attributeimportja3requestssession=ja3requests.session()params={"page":1,"page_size":100}# OR# params = "page=1&page_zie=100"# OR# params = [("page", 1), ("page_size", 100)]# OR# params = (("page", 1), ("page_size", 100))response=session.get("http://example.com/",params=params)print(response)Post Dataimportja3requestssession=ja3requests.session()data={"username":"admin","password":"admin"}# OR (Content-Type: application/x-www-form-urlencoded)# data = "username=admin&password=admin"# OR# data = [("username", "admin"), ("password": "admin")]# OR# data = (("username", "admin"), ("password", "admin"))response=session.post("http://example.com/",data=data)print(response)Post Jsonimportja3requestssession=ja3requests.session()data={"username":"admin","password":"admin"}# OR# import json# data = json.dumps(data)response=session.post("http://example.com/",json=data)print(response)Post Filesimportja3requestssession=ja3requests.session()withopen("/user/home/demo.txt","r")asf:response=session.post("http://example.com/",files={"field_name":f})print(response)# OR# response = session.post("http://example.com/", files={"field_name": "/user/home/demo.txt"})# multiple files# response = session.post("http://example.com/", files={"field_name": ["/user/home/demo.txt", "/user/home/demo2.txt"]})Use the proxies attributeimportja3requestssession=ja3requests.session()proxies={"http":"127.0.0.1:7890","https":"127.0.0.1:7890"}response=session.get("http://example.com/",proxies=proxies)print(response)# With Authorization information# proxies = {#     "http": "user:password@127.0.0.1:7890",#     "https": "user:password@127.0.0.1:7890"# }Use the cookies attributeimportja3requestssession=ja3requests.session()cookies={"sessionId":"xxxx","userId":"xxxx",}# OR# cookies = "sessionId=xxxx; userId=xxxx;...."# OR# cookies = <CookieJar()># Or set cookies in headers = {"Cookies": "sessionId=xxxx; userId=xxxx;...."}response=session.get("http://example.com/",cookies=cookies)print(response)Allow Redirectsimportja3requestssession=ja3requests.session()# Default allow_redirects=Trueresponse=session.get("http://example.com/",allow_redirects=False)print(response)ReferenceHTTPHTTP-RFC