cycurl icon indicating copy to clipboard operation
cycurl copied to clipboard

How do I use the library?

Open deedy5 opened this issue 10 months ago • 5 comments

Installation method

pip install cycurl

Test script

from cycurl import requests

r = requests.get("https://tools.scrapfly.io/api/fp/ja3", impersonate="chrome")
print(r.json())

Traceback

Traceback (most recent call last):
  File "/cycurl_test/c.py", line 2, in <module>
    from cycurl import requests
  File "/cycurl_test/.venv/lib/python3.13/site-packages/cycurl/__init__.py", line 2, in <module>
    from cycurl.__version__ import __curl_version__, __description__, __title__, __version__
  File "/cycurl_test/.venv/lib/python3.13/site-packages/cycurl/__version__.py", line 3, in <module>
    from cycurl._curl import Curl
ImportError: libcurl-impersonate-chrome.so.4: cannot open shared object file: No such file or directory

OS: debian 12

uv.lock:

version = 1
revision = 1
requires-python = ">=3.13"

[[package]]
name = "certifi"
version = "2025.1.31"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/1c/ab/c9f1e32b7b1bf505bf26f0ef697775960db7932abeb7b516de930ba2705f/certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651", size = 167577 }
wheels = [
    { url = "https://files.pythonhosted.org/packages/38/fc/bce832fd4fd99766c04d1ee0eead6b0ec6486fb100ae5e74c1d91292b982/certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe", size = 166393 },
]

[[package]]
name = "cycurl"
version = "0.9.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
    { name = "certifi" },
    { name = "cython" },
]
sdist = { url = "https://files.pythonhosted.org/packages/61/64/72d6ec93486d41f11ba4a0f7ae1a2120e102260c3d61ee9b3d6274c8025c/cycurl-0.9.0.tar.gz", hash = "sha256:498e842be1f78b1051a0cba489d9b4ebf32dcf249e3b9d9b3fb3ff539659968d", size = 61888111 }
wheels = [
    { url = "https://files.pythonhosted.org/packages/0a/c0/5b8f0b8e2c35432291ca9e14dd57c8fcdc7300d4ccabe1b0e66fc46cd30c/cycurl-0.9.0-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:ccde3253936df5b7cc179b832d6cd88a6754188bfbf6549999b8f8b074193fcf", size = 3834979 },
    { url = "https://files.pythonhosted.org/packages/63/d3/2a9323f6596506c2f13e403389f33ddb93a110475ad2539feef4ca48ab05/cycurl-0.9.0-cp313-cp313-manylinux2014_x86_64.whl", hash = "sha256:aa90e6cc4dfcc964ec334ab343cbd5c99cac7f1baaf392a23077f51910a50af9", size = 8564023 },
    { url = "https://files.pythonhosted.org/packages/8f/db/03c7ca1ac17b0c6d1de1eda97134693dda532696cdabff9b680015924623/cycurl-0.9.0-cp313-cp313-win_amd64.whl", hash = "sha256:c08e144b520b0f059364f7051177ff05657b68b69192c8f1d9bb6c51d44002f3", size = 2189936 },
]

[[package]]
name = "cycurl-test"
version = "0.1.0"
source = { virtual = "." }
dependencies = [
    { name = "cycurl" },
]

[package.metadata]
requires-dist = [{ name = "cycurl", specifier = ">=0.9.0" }]

[[package]]
name = "cython"
version = "3.0.12"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/5a/25/886e197c97a4b8e254173002cdc141441e878ff29aaa7d9ba560cd6e4866/cython-3.0.12.tar.gz", hash = "sha256:b988bb297ce76c671e28c97d017b95411010f7c77fa6623dd0bb47eed1aee1bc", size = 2757617 }
wheels = [
    { url = "https://files.pythonhosted.org/packages/67/ad/550ddcb8b5a5d9949fe6606595cce36984c1d42309f1e04af98f5933a7ea/Cython-3.0.12-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:4ee6f1ea1bead8e6cbc4e64571505b5d8dbdb3b58e679d31f3a84160cebf1a1a", size = 3393574 },
    { url = "https://files.pythonhosted.org/packages/34/de/ade0a80bea17197662e23d39d3d3fbf89e9e99e6ad91fd95ab87120edb3a/Cython-3.0.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:57aefa6d3341109e46ec1a13e3a763aaa2cbeb14e82af2485b318194be1d9170", size = 3367198 },
    { url = "https://files.pythonhosted.org/packages/a8/30/7f48207ea13dab46604db0dd388e807d53513ba6ad1c34462892072f8f8c/Cython-3.0.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:879ae9023958d63c0675015369384642d0afb9c9d1f3473df9186c42f7a9d265", size = 3535849 },
    { url = "https://files.pythonhosted.org/packages/81/ab/f61c79fa14bd433a7dfd1548c5e00d9bd18b557c2f836aaece4fb1b22f34/Cython-3.0.12-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:36fcd584dae547de6f095500a380f4a0cce72b7a7e409e9ff03cb9beed6ac7a1", size = 3559079 },
    { url = "https://files.pythonhosted.org/packages/d0/d1/1dbf17061229ccd35d5c0eed659fab60c2e50d2eadfa2a5729e753b6f4d0/Cython-3.0.12-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:62b79dcc0de49efe9e84b9d0e2ae0a6fc9b14691a65565da727aa2e2e63c6a28", size = 3436649 },
    { url = "https://files.pythonhosted.org/packages/2d/d4/9ce42fff6de5550f870cdde9a1482d69ea66a1249a88fa0d0df9adebfb1a/Cython-3.0.12-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4aa255781b093a8401109d8f2104bbb2e52de7639d5896aefafddc85c30e0894", size = 3644025 },
    { url = "https://files.pythonhosted.org/packages/e3/89/b0c847f9df92af3ef11281b6811c000bd6f8ce0db02e4374397f8d67f829/Cython-3.0.12-cp313-cp313-win32.whl", hash = "sha256:77d48f2d4bab9fe1236eb753d18f03e8b2619af5b6f05d51df0532a92dfb38ab", size = 2604911 },
    { url = "https://files.pythonhosted.org/packages/a6/5f/bbfaf2b5f7bf78854ecbc82f8473a3892ae5580e0c5bd0d4a82580b39ed3/Cython-3.0.12-cp313-cp313-win_amd64.whl", hash = "sha256:86c304b20bd57c727c7357e90d5ba1a2b6f1c45492de2373814d7745ef2e63b4", size = 2786786 },
    { url = "https://files.pythonhosted.org/packages/27/6b/7c87867d255cbce8167ed99fc65635e9395d2af0f0c915428f5b17ec412d/Cython-3.0.12-py2.py3-none-any.whl", hash = "sha256:0038c9bae46c459669390e53a1ec115f8096b2e4647ae007ff1bf4e6dee92806", size = 1171640 },
]

deedy5 avatar Mar 04 '25 07:03 deedy5

You must put the lib file in /usr/local, which is downloaded from here. I code in this way this because I can update the dependency without updating cycurl itself.

synodriver avatar Mar 13 '25 12:03 synodriver

Can you make it so that the installation (pip install cycurl) automatically installs the right libraries?

deedy5 avatar Mar 13 '25 13:03 deedy5

Can you make it so that the installation (pip install cycurl) automatically installs the right libraries?

It's not possible due to pip's security policy.(Imagine if a python package can place the lib file in /usr/local, it will have the ability to put any file at any place, e.g. overwrite .ssh file, that's a virus instead of a package...)

synodriver avatar Mar 13 '25 13:03 synodriver

Emmmm. Maybe changing RPATH will work...

synodriver avatar Mar 13 '25 14:03 synodriver

What if you save the required libraries in .local/bin folder?

deedy5 avatar Mar 13 '25 16:03 deedy5

Emmmm. Maybe changing RPATH will work...

When update on pypi?

rifkymcz avatar Jun 08 '25 02:06 rifkymcz

Emmmm. Maybe changing RPATH will work...

When update on pypi?

Actually I'm updating it when upstream release a new version, unluckily we both meet a problem: the latest libcurl-impersonate just fails to build on windows....

synodriver avatar Jun 08 '25 03:06 synodriver

Ok, this is fixed in the latest commit.

synodriver avatar Nov 01 '25 17:11 synodriver