diff options
author | noptuno <repollo.marrero@gmail.com> | 2023-04-28 02:29:30 +0200 |
---|---|---|
committer | noptuno <repollo.marrero@gmail.com> | 2023-04-28 02:29:30 +0200 |
commit | 355dee533bb34a571b9367820a63cccb668cf866 (patch) | |
tree | 838af886b4fec07320aeb10f0d1e74ba79e79b5c /venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info | |
parent | added pyproject.toml file (diff) | |
download | gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.gz gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.bz2 gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.lz gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.xz gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.zst gpt4free-355dee533bb34a571b9367820a63cccb668cf866.zip |
Diffstat (limited to 'venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info')
7 files changed, 340 insertions, 0 deletions
diff --git a/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/INSTALLER b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/INSTALLER new file mode 100644 index 00000000..a1b589e3 --- /dev/null +++ b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/LICENSE b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/LICENSE new file mode 100644 index 00000000..4d57b5aa --- /dev/null +++ b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2018 multippt +Copyright (c) 2022 Yifei Kong + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/METADATA b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/METADATA new file mode 100644 index 00000000..c817b4aa --- /dev/null +++ b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/METADATA @@ -0,0 +1,258 @@ +Metadata-Version: 2.1 +Name: curl-cffi +Version: 0.5.5 +Summary: libcurl ffi bindings for Python, with impersonation support +Author-email: Yifei Kong <kong@yifei.me> +License: MIT License + + Copyright (c) 2018 multippt + Copyright (c) 2022 Yifei Kong + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +Project-URL: repository, https://github.com/yifeikong/curl_cffi +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Requires-Python: >=3.7 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: cffi (>=1.12.0) +Provides-Extra: build +Requires-Dist: cibuildwheel ; extra == 'build' +Requires-Dist: wheel ; extra == 'build' +Provides-Extra: dev +Requires-Dist: autoflake (==1.4) ; extra == 'dev' +Requires-Dist: black (==22.8.0) ; extra == 'dev' +Requires-Dist: coverage (==6.4.1) ; extra == 'dev' +Requires-Dist: cryptography (==38.0.3) ; extra == 'dev' +Requires-Dist: flake8 (==6.0.0) ; extra == 'dev' +Requires-Dist: flake8-bugbear (==22.7.1) ; extra == 'dev' +Requires-Dist: flake8-pie (==0.15.0) ; extra == 'dev' +Requires-Dist: httpx (==0.23.1) ; extra == 'dev' +Requires-Dist: isort (==5.10.1) ; extra == 'dev' +Requires-Dist: mypy (==0.971) ; extra == 'dev' +Requires-Dist: types-certifi (==2021.10.8.2) ; extra == 'dev' +Requires-Dist: pytest (==7.1.2) ; extra == 'dev' +Requires-Dist: pytest-asyncio (==0.19.0) ; extra == 'dev' +Requires-Dist: pytest-trio (==0.7.0) ; extra == 'dev' +Requires-Dist: trio (==0.21.0) ; extra == 'dev' +Requires-Dist: trio-typing (==0.7.0) ; extra == 'dev' +Requires-Dist: trustme (==0.9.0) ; extra == 'dev' +Requires-Dist: uvicorn (==0.18.3) ; extra == 'dev' +Provides-Extra: test +Requires-Dist: cryptography (==38.0.3) ; extra == 'test' +Requires-Dist: httpx (==0.23.1) ; extra == 'test' +Requires-Dist: types-certifi (==2021.10.8.2) ; extra == 'test' +Requires-Dist: pytest (==7.1.2) ; extra == 'test' +Requires-Dist: pytest-asyncio (==0.19.0) ; extra == 'test' +Requires-Dist: pytest-trio (==0.7.0) ; extra == 'test' +Requires-Dist: trio (==0.21.0) ; extra == 'test' +Requires-Dist: trio-typing (==0.7.0) ; extra == 'test' +Requires-Dist: trustme (==0.9.0) ; extra == 'test' +Requires-Dist: uvicorn (==0.18.3) ; extra == 'test' + +# curl_cffi + +Python binding for [curl-impersonate](https://github.com/lwthiker/curl-impersonate) +via [CFFI](https://cffi.readthedocs.io/en/latest/). + +[中文文档](README-zh.md) + +Unlike other pure python http clients like `httpx` or `requests`, this package can +impersonate browsers' TLS signatures or JA3 fingerprints. If you are blocked by some +website for no obvious reason, you can give this package a try. + +## Note on Chrome 110+ JA3 fingerprints + +Chrome introduces ClientHello permutation in version 110, which means the order of +extensions will be random, thus JA3 fingerprints will be random. So, when comparing +JA3 fingerprints of `curl_cffi` and a browser, they may differ. However, this does not +mean that TLS fingerprints will not be a problem, ClientHello extension order is just +one factor of how servers can tell automated requests from browsers. + +See more from [this article](https://www.fastly.com/blog/a-first-look-at-chromes-tls-clienthello-permutation-in-the-wild) +and [curl-impersonate notes](https://github.com/lwthiker/curl-impersonate/pull/148) + +## Install + + pip install --upgrade curl_cffi + +This should work for Linux(x86_64/aarch64), macOS(Intel/Apple Silicon), Windows(amd64). +If it does not work, you may need to compile and install `curl-impersonate` first. + +## Usage + +`requests/httpx`-like API: + +```python +from curl_cffi import requests + +# Notice the impersonate parameter +r = requests.get("https://tls.browserleaks.com/json", impersonate="chrome101") + +print(r.json()) +# output: {'ja3_hash': '53ff64ddf993ca882b70e1c82af5da49' +# the fingerprint should be the same as target browser + +# proxies are supported +proxies = {"https": "http://localhost:3128"} +r = requests.get("https://tls.browserleaks.com/json", impersonate="chrome101", proxies=proxies) + +# socks proxies are also supported +proxies = {"https": "socks://localhost:3128"} +r = requests.get("https://tls.browserleaks.com/json", impersonate="chrome101", proxies=proxies) +``` + +### Sessions + +```python +# sessions are supported +s = requests.Session() +# httpbin is a http test website +s.get("https://httpbin.org/cookies/set/foo/bar") +print(s.cookies) +# <Cookies[<Cookie foo=bar for httpbin.org />]> +r = s.get("https://httpbin.org/cookies") +print(r.json()) +# {'cookies': {'foo': 'bar'}} +``` + +Supported impersonate versions: + +- chrome99 +- chrome100 +- chrome101 +- chrome104 +- chrome107 +- chrome110 +- chrome99_android +- edge99 +- edge101 +- safari15_3 +- safari15_5 + +Alternatively, you can use the low-level curl-like API: + +```python +from curl_cffi import Curl, CurlOpt +from io import BytesIO + +buffer = BytesIO() +c = Curl() +c.setopt(CurlOpt.URL, b'https://tls.browserleaks.com/json') +c.setopt(CurlOpt.WRITEDATA, buffer) + +c.impersonate("chrome101") + +c.perform() +c.close() +body = buffer.getvalue() +print(body.decode()) +``` + +See `example.py` or `tests/` for more examples. + +## API + +Requests: almost the same as requests. + +Curl object: + +* `setopt(CurlOpt, value)`: Sets curl options as in `curl_easy_setopt` +* `perform()`: Performs curl request, as in `curl_easy_perform` +* `getinfo(CurlInfo)`: Gets information in response after curl perform, as in `curl_easy_getinfo` +* `close()`: Closes and cleans up the curl object, as in `curl_easy_cleanup` + +Enum values to be used with `setopt` and `getinfo`, and can be accessed from `CurlOpt` and `CurlInfo`. + +## Trouble Shooting + +### Pyinstaller `ModuleNotFoundError: No module named '_cffi_backend'` + +You need to tell pyinstaller to pack cffi and data files inside the package: + + pyinstaller -F .\example.py --hidden-import=_cffi_backend --collect-all curl_cffi + +### Using https proxy, error: `OPENSSL_internal:WRONG_VERSION_NUMBER` + +You are messing up https-over-http proxy and https-over-https proxy, for most cases, you +should change `{"https": "https://localhost:3128"}` to `{"https": "http://localhost:3128"}`. +Note the protocol in the url for https proxy is `http` not `https`. + +See [this issue](https://github.com/yifeikong/curl_cffi/issues/6#issuecomment-1415162495) for a detailed explaination. + +## Current Status + +This implementation is very hacky now, but it works for most common systems. + +When people installing other python curl bindings, like `pycurl`, they often face +compiling issues or OpenSSL issues, so I really hope that this package can be distributed +as a compiled binary package, uses would be able to use it by a simple `pip install`, no +more compile errors. + +For now, I just download the pre-compiled `libcurl-impersonate` from github and build a +bdist wheel, which is a binary package format used by PyPI, and upload it. However, the +right way is to download curl and curl-impersonate sources on our side and compile them +all together. + +Help wanted! + +TODOs: + +- [ ] Write docs. +- [x] Binary package for macOS(Intel/AppleSilicon) and Windows. +- [ ] Support musllinux(alpine) bdist by building from source. +- [x] Exclude the curl headers from source, download them when building. +- [x] Update curl header files and constants via scripts. +- [x] Implement `requests.Session/httpx.Client`. +- [x] Create [ABI3 wheels](https://cibuildwheel.readthedocs.io/en/stable/faq/#abi3) to reduce package size and build time. +- [ ] Set default headers as in curl-impersonate wrapper scripts. +- [ ] Support stream in asyncio mode + <!--use loop.call_soon(q.put_nowait), wait for headers, then let user iter over content --> + +## Change Log + +- 0.5.0 + - Added asyncio support + +- 0.4.0 + - Removed c shim callback function, use cffi native callback function + +- 0.3.6 + - Updated to curl-impersonate v0.5.4, supported chrome107 and chrome110 + +- 0.3.0, copied more code from `httpx` to support session + - Add `requests.Session` + - Breaking change: `Response.cookies` changed from `http.cookies.SimpleCookie` to `curl_cffi.requests.Cookies` + - Using ABI3 wheels to reduce package size. + +## Acknowledgement + +- This package was originally forked from https://github.com/multippt/python_curl_cffi , which is under the MIT license. +- headers/cookies files are copied from https://github.com/encode/httpx/blob/master/httpx/_models.py , which is under the BSD license. +- Asyncio support is inspired by Tornado's curl http client. + diff --git a/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/RECORD b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/RECORD new file mode 100644 index 00000000..a7b8c84c --- /dev/null +++ b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/RECORD @@ -0,0 +1,53 @@ +curl_cffi-0.5.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+curl_cffi-0.5.5.dist-info/LICENSE,sha256=Xp2Jk4f-hCxHc54ABT_2dZOouOQSY59mB94vDts3NYQ,1095
+curl_cffi-0.5.5.dist-info/METADATA,sha256=TKwq5xU2J6wsyoSrhWO2l4O1p3MLfk_ufusFDORSYZg,9907
+curl_cffi-0.5.5.dist-info/RECORD,,
+curl_cffi-0.5.5.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+curl_cffi-0.5.5.dist-info/WHEEL,sha256=7ad0zCsNabDCkU5Sa8iiGfjiIOyzELDu3Sd2bSoJB6Y,109
+curl_cffi-0.5.5.dist-info/top_level.txt,sha256=b51YB50I_vu6XAbSERmqtgaYciYADCA_baVoZ_T5Lzs,10
+curl_cffi/.dylibs/libcrypto.1.1.dylib,sha256=wKMuhfvr2BsJByTDN9WO9n8PvTBN48dnAl8UXSMWFfg,2474768
+curl_cffi/.dylibs/libcurl-impersonate-chrome.4.dylib,sha256=uO_3hv1CIVUAX1qsX0phduB6ArMHla0VXzTeGdK4Hto,3472432
+curl_cffi/.dylibs/libidn2.0.dylib,sha256=5g_zXNk_nvj7omlx46OeeOlqzPdvYD1e7pbzLx4bLzs,259312
+curl_cffi/.dylibs/libintl.8.dylib,sha256=FQQyNRam-bvZu531v7oLGX-sMAKJAeL0JK8AcnnlpfE,110896
+curl_cffi/.dylibs/librtmp.1.dylib,sha256=ytZVVkuqy6uCD2zQeFMxw-cLwDjl9uYzRRcTXprN5zQ,150384
+curl_cffi/.dylibs/libssl.1.1.dylib,sha256=nl6kaPrt7ydMhXsjgIrtwN4PaNVdLQ6HISnPt181lUw,525008
+curl_cffi/.dylibs/libunistring.5.dylib,sha256=SkLbBLG3xtjBI53CzfDP9rZ9IpuZRiSPY6Xn2I-h8fI,1765424
+curl_cffi/.dylibs/libzstd.1.5.5.dylib,sha256=uIrn3b1MmnJNYCICMi5KjvTCA-tZnRxTpcZijJ9Q7zU,884416
+curl_cffi/__init__.py,sha256=i45yGwDbFbY8GRMIDWtGrCWamKk0tmxtD82zfneY2Fo,286
+curl_cffi/__pycache__/__init__.cpython-39.pyc,,
+curl_cffi/__pycache__/aio.cpython-39.pyc,,
+curl_cffi/__pycache__/build.cpython-39.pyc,,
+curl_cffi/__pycache__/const.cpython-39.pyc,,
+curl_cffi/__pycache__/curl.cpython-39.pyc,,
+curl_cffi/_wrapper.abi3.so,sha256=xKqSlJrZPHTx-ADD0kGetOm6hwPwFDFqiLDH--Ph27Q,61440
+curl_cffi/aio.py,sha256=L-yozcEFbG4R2AX7gl64vaamNqcmRCDgb5I7gT23lwE,5542
+curl_cffi/build.py,sha256=4gs4x3-bcrFoOTm_X0KiXPO95W3eeXpmutVdH9xHnqQ,1101
+curl_cffi/cacert.pem,sha256=-x7NZB0KAsAbyQNtUTy2WLvaYqdeJGvtvAF2RWCmOfA,216583
+curl_cffi/const.py,sha256=GyWp0bCm5inAsm59OLkdv9oYWbTfKYMvjF8wml__vIQ,12654
+curl_cffi/curl.py,sha256=F-TDqz8izkYRlcxmgdzQq9qVwU-3YsGhFm9Fz1U7Sco,7485
+curl_cffi/ffi/cdef.c,sha256=GrRP3_D0pYkty1zYkHZOfg0dlPX_AuaF2lpptnshA9U,1659
+curl_cffi/ffi/shim.c,sha256=097wJcxREoIp_Of6FLNXtJjzrGNaOZ-q9neSWiZg-7U,795
+curl_cffi/ffi/shim.h,sha256=EDv9W4yy_CuZshqy9PbpiwbgdJBqG8VdFTiu6lQ70as,166
+curl_cffi/include/curl/Makefile.am,sha256=JNctVpF40zjgPLAQBvPFbgrpl753Lh1njE_uWu3RkpU,1504
+curl_cffi/include/curl/Makefile.in,sha256=sg03JlwrAMgb896zlmaLPCXcAXx6G65C6pku4b4XXds,22123
+curl_cffi/include/curl/curl.h,sha256=pFh4ZWyJpKU_ttXHP5UNi5jsnQFLju_CEGT_s3X-wG4,123882
+curl_cffi/include/curl/curlver.h,sha256=tMvBaI93N2gCsMfFflmpYcAq-53SGM5zOwkeC-w_bsc,3071
+curl_cffi/include/curl/easy.h,sha256=nQWxQWo6FAwQMhteYW_ULXTSlYxAjF6aO13Iavju7Og,4454
+curl_cffi/include/curl/header.h,sha256=ahaeKPoOm8vh4iAJHncwI76teyQsdDNJYBP-00eS9Pk,2829
+curl_cffi/include/curl/mprintf.h,sha256=vOmCknKCSyrzL9cwVDn-0dVWqaVm1RDxRAvS9m6xYkw,2105
+curl_cffi/include/curl/multi.h,sha256=K38QlY7YENLNyNbfyYnRav8LmOlSfzwpvA26X_GV9cU,17299
+curl_cffi/include/curl/options.h,sha256=qryE8_WuU5XIHT-UuRXKxeirdouOVi5lxmZko-uXH14,2414
+curl_cffi/include/curl/stdcheaders.h,sha256=zXonUOUrWsoUaB47N-pJU_GGh8UamykWXWM6M2yQQXI,1375
+curl_cffi/include/curl/system.h,sha256=mkxCvBAzfHQnQFFdQzpD7kp8Ul1ramfd9rsiakHnmnI,18524
+curl_cffi/include/curl/typecheck-gcc.h,sha256=our13vmZ87J6-XHihdtiigKpiyg4TWCiOt4u03o676U,43023
+curl_cffi/include/curl/urlapi.h,sha256=IS5Vbh3udIr4_Um3Z6BEfX41I3EOORNg2K_ZWwccwYU,5293
+curl_cffi/requests/__init__.py,sha256=zPDSv98t2MbgJ_Gc3as1ctFU4-nFjdAizN5aLKALIsM,1851
+curl_cffi/requests/__pycache__/__init__.cpython-39.pyc,,
+curl_cffi/requests/__pycache__/cookies.cpython-39.pyc,,
+curl_cffi/requests/__pycache__/errors.cpython-39.pyc,,
+curl_cffi/requests/__pycache__/headers.cpython-39.pyc,,
+curl_cffi/requests/__pycache__/session.cpython-39.pyc,,
+curl_cffi/requests/cookies.py,sha256=fInxDBBgAvJ5j_Gx9NpCHjacR2yqFxvsoAc_Ht3Ec7M,8451
+curl_cffi/requests/errors.py,sha256=gA5OOxhqfMrgdxdPeCR0bnDZ366keQZ6ntZK0qqKIeU,68
+curl_cffi/requests/headers.py,sha256=BRfzLKcjM2CFMdCdKBhojmztfrMAHRL3SE1xl6UqFE8,10803
+curl_cffi/requests/session.py,sha256=jKx2zTEYVmYdR8XzXIQ5VGpvJIB3b-jYX7Xf8-qDBB4,16996
diff --git a/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/REQUESTED b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/REQUESTED new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/REQUESTED diff --git a/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/WHEEL b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/WHEEL new file mode 100644 index 00000000..549e4666 --- /dev/null +++ b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.40.0) +Root-Is-Purelib: false +Tag: cp37-abi3-macosx_10_9_x86_64 + diff --git a/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/top_level.txt b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/top_level.txt new file mode 100644 index 00000000..ddbee0c3 --- /dev/null +++ b/venv/lib/python3.9/site-packages/curl_cffi-0.5.5.dist-info/top_level.txt @@ -0,0 +1 @@ +curl_cffi |