# Ja3Requests
**Ja3Requests** is a http request library that can customize ja3 or h2 fingerprints.
[中文文档](README-zh.md)
```pycon
>>> import ja3requests
>>> session = ja3requests.Session()
>>> response = session.get("http://www.baidu.com/")
>>> response
<Response [200]>
>>> response.status_code
200
>>> 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 Versions
Ja3Requests is available on PyPI:
```console
$ python -m pip install ja3requests
```
Ja3Requests officially supports Python 3.7+.
## How To Use
### Unreasonable Request Method
Ja3Requests supports multiple request methods such as Get, Post, Put, Delete, etc.
```python
import ja3requests
session = ja3requests.session()
# Get
session.get("http://example.com/")
# POST
session.post("http://example.com/")
...
```
### Use The Headers Attribute
```python
import ja3requests
headers = {
"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 Attribute
```python
import ja3requests
session = 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 Data
```python
import ja3requests
session = 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 Json
```python
import ja3requests
session = 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 Files
```python
import ja3requests
session = ja3requests.session()
with open("/user/home/demo.txt", "r") as f:
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 attribute
```python
import ja3requests
session = 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 attribute
```python
import ja3requests
session = 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 Redirects
```python
import ja3requests
session = ja3requests.session()
# Default allow_redirects=True
response = session.get("http://example.com/", allow_redirects=False)
print(response)
```
## Reference
- [HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP)
- [HTTP-RFC](https://www.rfc-editor.org/rfc/rfc2068.html)
Raw data
{
"_id": null,
"home_page": "https://github.com/lxjmaster/ja3requests",
"name": "ja3requests",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pip,ja3requests,ja3,requests",
"author": "Mast Luo",
"author_email": "379501669@qq.com",
"download_url": "https://files.pythonhosted.org/packages/04/6d/8453532cd1fcedd42910fecbf515303dbf61875e09d05569e778122785a4/ja3requests-1.1.0.tar.gz",
"platform": "any",
"description": "\n\n# Ja3Requests\n**Ja3Requests** is a http request library that can customize ja3 or h2 fingerprints.\n\n[\u4e2d\u6587\u6587\u6863](README-zh.md)\n\n```pycon\n>>> import ja3requests\n>>> session = ja3requests.Session()\n>>> response = session.get(\"http://www.baidu.com/\")\n>>> response\n<Response [200]>\n>>> response.status_code\n200\n>>> response.headers\n{'Content-Length': '405968', 'Content-Type': 'text/html; charset=utf-8', 'Server': 'BWS/1.1', 'Vary': 'Accept-Encoding', 'X-Ua-Compatible': 'IE=Edge,chrome=1', ...}\n>>> response.text\n'<!DOCTYPE html><!--STATUS OK--><html><head><meta http-equiv=\"Content-Type\" content=\"text/html;char...'\n```\n\nJa3Requests currently implements only the HTTP protocol and a few methods.\n\n## Installing Ja3Requests and Supported Versions\n\nJa3Requests is available on PyPI:\n\n```console\n$ python -m pip install ja3requests\n```\n\nJa3Requests officially supports Python 3.7+.\n\n## How To Use\n### Unreasonable Request Method\nJa3Requests supports multiple request methods such as Get, Post, Put, Delete, etc.\n```python\nimport ja3requests\n\nsession = ja3requests.session()\n# Get\nsession.get(\"http://example.com/\")\n\n# POST\nsession.post(\"http://example.com/\")\n...\n```\n\n### Use The Headers Attribute\n```python\nimport ja3requests\n\nheaders = {\n \"Accept\": \"*/*\",\n \"Accept-Encoding\": \"gzip, deflate, br\",\n \"Connection\": \"keep-alive\",\n \"Host\": \"example.com\",\n \"User-Agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0\"\n}\n\nsession = ja3requests.session()\n\nresponse = session.get(\"http://example.com/\", headers=headers)\nprint(response)\n```\n\n### Use The Params Attribute\n```python\nimport ja3requests\n\nsession = ja3requests.session()\n\nparams = {\n \"page\": 1,\n \"page_size\": 100\n}\n# OR\n# params = \"page=1&page_zie=100\"\n# OR\n# params = [(\"page\", 1), (\"page_size\", 100)]\n# OR\n# params = ((\"page\", 1), (\"page_size\", 100))\nresponse = session.get(\"http://example.com/\", params=params)\nprint(response)\n```\n\n\n### Post Data\n```python\nimport ja3requests\n\nsession = ja3requests.session()\n\ndata = {\n \"username\": \"admin\",\n \"password\": \"admin\"\n}\n# OR (Content-Type: application/x-www-form-urlencoded)\n# data = \"username=admin&password=admin\"\n# OR\n# data = [(\"username\", \"admin\"), (\"password\": \"admin\")]\n# OR\n# data = ((\"username\", \"admin\"), (\"password\", \"admin\"))\n\nresponse = session.post(\"http://example.com/\", data=data)\nprint(response)\n```\n\n\n### Post Json\n\n```python\nimport ja3requests\n\nsession = ja3requests.session()\n\ndata = {\n \"username\": \"admin\",\n \"password\": \"admin\"\n}\n# OR\n# import json\n# data = json.dumps(data)\n\nresponse = session.post(\"http://example.com/\", json=data)\nprint(response)\n```\n\n\n### Post Files\n\n```python\nimport ja3requests\n\nsession = ja3requests.session()\n\nwith open(\"/user/home/demo.txt\", \"r\") as f:\n response = session.post(\"http://example.com/\", files={\"field_name\": f})\nprint(response)\n\n# OR\n# response = session.post(\"http://example.com/\", files={\"field_name\": \"/user/home/demo.txt\"})\n\n# multiple files\n# response = session.post(\"http://example.com/\", files={\"field_name\": [\"/user/home/demo.txt\", \"/user/home/demo2.txt\"]})\n```\n\n\n### Use the proxies attribute\n\n```python\nimport ja3requests\n\nsession = ja3requests.session()\n\nproxies = {\n \"http\": \"127.0.0.1:7890\",\n \"https\": \"127.0.0.1:7890\"\n}\n\nresponse = session.get(\"http://example.com/\", proxies=proxies)\nprint(response)\n\n# With Authorization information\n# proxies = {\n# \"http\": \"user:password@127.0.0.1:7890\",\n# \"https\": \"user:password@127.0.0.1:7890\"\n# }\n```\n\n\n### Use the cookies attribute\n\n```python\nimport ja3requests\n\nsession = ja3requests.session()\ncookies = {\n \"sessionId\": \"xxxx\",\n \"userId\": \"xxxx\",\n}\n# OR\n# cookies = \"sessionId=xxxx; userId=xxxx;....\"\n# OR\n# cookies = <CookieJar()>\n\n# Or set cookies in headers = {\"Cookies\": \"sessionId=xxxx; userId=xxxx;....\"}\n\nresponse = session.get(\"http://example.com/\", cookies=cookies)\nprint(response)\n```\n\n\n### Allow Redirects\n\n```python\nimport ja3requests\n\nsession = ja3requests.session()\n\n# Default allow_redirects=True\nresponse = session.get(\"http://example.com/\", allow_redirects=False)\nprint(response)\n```\n\n\n## Reference\n- [HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP)\n- [HTTP-RFC](https://www.rfc-editor.org/rfc/rfc2068.html)\n",
"bugtrack_url": null,
"license": "Apache-2.0 license",
"summary": "A http request library that can customize JA3 or H2 fingerprints.",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/lxjmaster/ja3requests"
},
"split_keywords": [
"pip",
"ja3requests",
"ja3",
"requests"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3dd5a5e9e1da250a33c53bd6c5baed0383a94f979b27ba2e3212d2d6b0afdac4",
"md5": "d567aa689c8d90a13a4dc5750146bba4",
"sha256": "c37853ab0952dce60850154ed39a538c6831a5aec182bbb8af65a26ef1f05285"
},
"downloads": -1,
"filename": "ja3requests-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d567aa689c8d90a13a4dc5750146bba4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 35865,
"upload_time": "2024-01-15T10:58:10",
"upload_time_iso_8601": "2024-01-15T10:58:10.794947Z",
"url": "https://files.pythonhosted.org/packages/3d/d5/a5e9e1da250a33c53bd6c5baed0383a94f979b27ba2e3212d2d6b0afdac4/ja3requests-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "046d8453532cd1fcedd42910fecbf515303dbf61875e09d05569e778122785a4",
"md5": "0684c8347a0b8beb84f4ecd9f2f84846",
"sha256": "308eb4af3e020b26ac153de8fd0348114b4603f04e73ebe054bdd1fb542a3810"
},
"downloads": -1,
"filename": "ja3requests-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0684c8347a0b8beb84f4ecd9f2f84846",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 32463,
"upload_time": "2024-01-15T10:58:12",
"upload_time_iso_8601": "2024-01-15T10:58:12.851836Z",
"url": "https://files.pythonhosted.org/packages/04/6d/8453532cd1fcedd42910fecbf515303dbf61875e09d05569e778122785a4/ja3requests-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-15 10:58:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lxjmaster",
"github_project": "ja3requests",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "ja3requests"
}