From 8e69ad74f6fbff2a58148f0712c8f2247517e366 Mon Sep 17 00:00:00 2001 From: Lyonnet Date: Sun, 18 Aug 2024 13:27:54 +0800 Subject: [PATCH] Further remove info due to worrying political environment in China --- Makefile | 2 +- README.md | 10 +++++----- curl_cffi/curl.py | 2 +- curl_cffi/requests/session.py | 8 ++++---- docs/faq.rst | 14 +++++++------- docs/impersonate.rst | 6 +++--- docs/index.rst | 8 ++++---- docs/install.rst | 2 +- docs/vs-requests.rst | 6 +++--- pyproject.toml | 4 ++-- scripts/build.py | 2 +- tests/unittest/test_async_session.py | 6 +++--- tests/unittest/test_curl.py | 4 ++-- tests/unittest/test_requests.py | 18 +++++++++--------- 14 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index da7928f3..4f92d6ad 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ $(CURL_VERSION): mv curl-$(CURL_VERSION) $(CURL_VERSION) curl-impersonate-$(VERSION)/chrome/patches: $(CURL_VERSION) - curl -L "https://github.com/yifeikong/curl-impersonate/archive/refs/tags/v$(VERSION).tar.gz" \ + curl -L "https://github.com/lexiforest/curl-impersonate/archive/refs/tags/v$(VERSION).tar.gz" \ -o "curl-impersonate-$(VERSION).tar.gz" tar -xf curl-impersonate-$(VERSION).tar.gz diff --git a/README.md b/README.md index 175b4476..df7f55a8 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Only Python 3.8 and above are supported. Python 3.7 has reached its end of life. ------ -Scrapfly.io +Scrapfly.io [Scrapfly](https://scrapfly.io/?utm_source=github&utm_medium=sponsoring&utm_campaign=curl_cffi) is an enterprise-grade solution providing Web Scraping API that aims to simplify the @@ -39,7 +39,7 @@ If you are managing TLS/HTTP fingerprint by yourself with `curl_cffi`, they also ## Features - Supports JA3/TLS and http2 fingerprints impersonation, inlucding recent browsers and custome fingerprints. -- Much faster than requests/httpx, on par with aiohttp/pycurl, see [benchmarks](https://github.com/yifeikong/curl_cffi/tree/main/benchmark). +- Much faster than requests/httpx, on par with aiohttp/pycurl, see [benchmarks](https://github.com/lexiforest/curl_cffi/tree/main/benchmark). - Mimics requests API, no need to learn another one. - Pre-compiled, so you don't have to compile on your machine. - Supports `asyncio` with proxy rotation on each request. @@ -69,7 +69,7 @@ To install beta releases: To install unstable version from GitHub: - git clone https://github.com/yifeikong/curl_cffi/ + git clone https://github.com/lexiforest/curl_cffi/ cd curl_cffi make preprocess pip install . @@ -126,9 +126,9 @@ print(r.json()) # {'cookies': {'foo': 'bar'}} ``` -`curl_cffi` supports the same browser versions as supported by my [fork](https://github.com/yifeikong/curl-impersonate) of [curl-impersonate](https://github.com/lwthiker/curl-impersonate): +`curl_cffi` supports the same browser versions as supported by my [fork](https://github.com/lexiforest/curl-impersonate) of [curl-impersonate](https://github.com/lwthiker/curl-impersonate): -However, only Chrome-like browsers are supported. Firefox support is tracked in [#59](https://github.com/yifeikong/curl_cffi/issues/59). +However, only Chrome-like browsers are supported. Firefox support is tracked in [#59](https://github.com/lexiforest/curl_cffi/issues/59). Browser versions will be added **only** when their fingerprints change. If you see a version, e.g. chrome122, were skipped, you can simply impersonate it with your own headers and the previous version. diff --git a/curl_cffi/curl.py b/curl_cffi/curl.py index f1b976cd..df019216 100644 --- a/curl_cffi/curl.py +++ b/curl_cffi/curl.py @@ -77,7 +77,7 @@ def write_callback(ptr, size, nmemb, userdata): return nmemb * size -# Credits: @alexio777 on https://github.com/yifeikong/curl_cffi/issues/4 +# Credits: @alexio777 on https://github.com/lexiforest/curl_cffi/issues/4 def slist_to_list(head) -> List[bytes]: """Converts curl slist to a python list.""" result = [] diff --git a/curl_cffi/requests/session.py b/curl_cffi/requests/session.py index 5d90041f..2458c6a0 100644 --- a/curl_cffi/requests/session.py +++ b/curl_cffi/requests/session.py @@ -434,7 +434,7 @@ def _set_curl_options( # remove Host header if it's unnecessary, otherwise curl may get confused. # Host header will be automatically added by curl if it's not present. - # https://github.com/yifeikong/curl_cffi/issues/119 + # https://github.com/lexiforest/curl_cffi/issues/119 host_header = h.get("Host") if host_header is not None: u = urlparse(url) @@ -476,7 +476,7 @@ def _set_curl_options( if files: raise NotImplementedError( "files is not supported, use `multipart`. See examples here: " - "https://github.com/yifeikong/curl_cffi/blob/main/examples/upload.py" + "https://github.com/lexiforest/curl_cffi/blob/main/examples/upload.py" ) # multipart @@ -508,7 +508,7 @@ def _set_curl_options( if not stream: c.setopt(CurlOpt.TIMEOUT_MS, int(all_timeout * 1000)) else: - # trick from: https://github.com/yifeikong/curl_cffi/issues/156 + # trick from: https://github.com/lexiforest/curl_cffi/issues/156 c.setopt(CurlOpt.LOW_SPEED_LIMIT, 1) c.setopt(CurlOpt.LOW_SPEED_TIME, math.ceil(all_timeout)) @@ -563,7 +563,7 @@ def _set_curl_options( warnings.warn( "Make sure you are using https over https proxy, otherwise, " "the proxy prefix should be 'http://' not 'https://', " - "see: https://github.com/yifeikong/curl_cffi/issues/6", + "see: https://github.com/lexiforest/curl_cffi/issues/6", RuntimeWarning, stacklevel=2, ) diff --git a/docs/faq.rst b/docs/faq.rst index d34b63f4..5ca35181 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -96,10 +96,10 @@ To force curl to use http 1.1 only. Related issues: -- `#19 `_, -- `#42 `_, -- `#79 `_, -- `#165 `_, +- `#19 `_, +- `#42 `_, +- `#79 `_, +- `#165 `_, Packaging with PyInstaller @@ -127,8 +127,8 @@ Add other paths: See also: -- `#5 `_ -- `#48 `_ +- `#5 `_ +- `#48 `_ How to set proxy? ------ @@ -145,7 +145,7 @@ You can also use the ``http_proxy``, ``https_proxy``, and ``ws_proxy``, ``wss_pr environment variables, respectively. For explanation of differences between ``http_proxy`` and ``https_proxy``, please see -`#6 `_. +`#6 `_. How to change the order of headers? diff --git a/docs/impersonate.rst b/docs/impersonate.rst index b3647755..13995675 100644 --- a/docs/impersonate.rst +++ b/docs/impersonate.rst @@ -4,9 +4,9 @@ Impersonate guide Supported browser versions -------------------------- -``curl_cffi`` supports the same browser versions as supported by our `fork `_ of `curl-impersonate `_: +``curl_cffi`` supports the same browser versions as supported by our `fork `_ of `curl-impersonate `_: -However, only Chrome-like browsers are supported. Firefox support is tracked in `#59 `_. +However, only Chrome-like browsers are supported. Firefox support is tracked in `#59 `_. Browser versions will be added **only** when their fingerprints change. If you see a version, e.g. chrome122, were skipped, you can simply impersonate it with your own headers and the previous version. @@ -148,7 +148,7 @@ For Akamai http2 fingerprints, you can fully customize the 3 parts: For a complete list of options and explanation, see the `curl-impersoante README`_. -.. _curl-impersonate README: https://github.com/yifeikong/curl-impersonate?tab=readme-ov-file#libcurl-impersonate +.. _curl-impersonate README: https://github.com/lexiforest/curl-impersonate?tab=readme-ov-file#libcurl-impersonate Should I randomize my fingerprints for each request? diff --git a/docs/index.rst b/docs/index.rst index a1ad3135..f032b90f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -25,7 +25,7 @@ Welcome to curl_cffi's documentation! curl_cffi is a Python binding for `curl-impersonate`_ via `cffi`_. -.. _curl-impersonate: https://github.com/yifeikong/curl-impersonate +.. _curl-impersonate: https://github.com/lexiforest/curl-impersonate .. _cffi: https://cffi.readthedocs.io/en/latest/ Unlike other pure Python http clients like ``httpx`` or ``requests``, ``curl_cffi`` can @@ -34,7 +34,7 @@ website for no obvious reason, you can give this package a try. ------ -.. image:: https://raw.githubusercontent.com/yifeikong/curl_cffi/main/assets/scrapfly.png +.. image:: https://raw.githubusercontent.com/lexiforest/curl_cffi/main/assets/scrapfly.png :width: 300 :alt: Scrapfly :target: https://scrapfly.io/?utm_source=github&utm_medium=sponsoring&utm_campaign=curl_cffi @@ -56,7 +56,7 @@ Features ------ - Supports JA3/TLS and http2 fingerprints impersonation. -- Much faster than requests/httpx, on par with aiohttp/pycurl, see `benchmarks `_. +- Much faster than requests/httpx, on par with aiohttp/pycurl, see `benchmarks `_. - Mimics requests API, no need to learn another one. - Pre-compiled, so you don't have to compile on your machine. - Supports ``asyncio`` with proxy rotation on each request. @@ -223,7 +223,7 @@ Click `here `_ to buy me a coffee. Bypass Cloudflare with API ~~~~~~ -.. image:: https://raw.githubusercontent.com/yifeikong/curl_cffi/main/assets/yescaptcha.png +.. image:: https://raw.githubusercontent.com/lexiforest/curl_cffi/main/assets/yescaptcha.png :width: 149 :alt: YesCaptcha :target: https://yescaptcha.com/i/stfnIO diff --git a/docs/install.rst b/docs/install.rst index 15b58dd0..08aaeffc 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -40,7 +40,7 @@ To install the latest unstable version from GitHub: .. code-block:: - git clone https://github.com/yifeikong/curl_cffi/ + git clone https://github.com/lexiforest/curl_cffi/ cd curl_cffi make preprocess pip install . diff --git a/docs/vs-requests.rst b/docs/vs-requests.rst index 07d7300c..1844cf8c 100644 --- a/docs/vs-requests.rst +++ b/docs/vs-requests.rst @@ -5,6 +5,6 @@ Although we try our best to mimic the requests API, some functionality is not ea Here are a list of known incompatibilities: - files API are slightly different, but more error-proof. -- retries are not supported yet, tracked in [#24](https://github.com/yifeikong/curl_cffi/issues/24) -- redirect history are not supported, tracked in [#82](https://github.com/yifeikong/curl_cffi/issues/82) -- empty-domains cookies may lost during redirects, tracked in [#55](https://github.com/yifeikong/curl_cffi/issues/55) +- retries are not supported yet, tracked in [#24](https://github.com/lexiforest/curl_cffi/issues/24) +- redirect history are not supported, tracked in [#82](https://github.com/lexiforest/curl_cffi/issues/82) +- empty-domains cookies may lost during redirects, tracked in [#55](https://github.com/lexiforest/curl_cffi/issues/55) diff --git a/pyproject.toml b/pyproject.toml index 9e2e8325..7e0afca3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "curl_cffi" version = "0.7.1" -authors = [{ name = "Yifei Kong", email = "kong@yifei.me" }] +authors = [{ name = "Lyonnet", email = "infinitesheldon@gmail.com" }] description = "libcurl ffi bindings for Python, with impersonation support." license = { file = "LICENSE" } dependencies = [ @@ -10,7 +10,7 @@ dependencies = [ ] readme = "README.md" requires-python = ">=3.8" -urls = { "repository" = "https://github.com/yifeikong/curl_cffi" } +urls = { "repository" = "https://github.com/lexiforest/curl_cffi" } classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", diff --git a/scripts/build.py b/scripts/build.py index 48918677..4188bb9e 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -57,7 +57,7 @@ def download_libcurl(): sysname = "linux-" + arch["libc"] if arch["system"] == "Linux" else arch["sysname"] url = ( - f"https://github.com/yifeikong/curl-impersonate/releases/download/" + f"https://github.com/lexiforest/curl-impersonate/releases/download/" f"v{__version__}/libcurl-impersonate-v{__version__}" f".{arch['so_arch']}-{sysname}.tar.gz" ) diff --git a/tests/unittest/test_async_session.py b/tests/unittest/test_async_session.py index fa9a0d23..200e762d 100644 --- a/tests/unittest/test_async_session.py +++ b/tests/unittest/test_async_session.py @@ -250,7 +250,7 @@ async def test_session_cookies(server): assert cookies["hello"] == "world" -# https://github.com/yifeikong/curl_cffi/issues/16 +# https://github.com/lexiforest/curl_cffi/issues/16 async def test_session_with_headers(server): async with AsyncSession() as s: r = await s.get(str(server.url), headers={"Foo": "bar"}) @@ -267,7 +267,7 @@ async def test_session_too_many_headers(server): assert headers["Foo"][0] == "2" -# https://github.com/yifeikong/curl_cffi/issues/222 +# https://github.com/lexiforest/curl_cffi/issues/222 async def test_closed_session_throws_error(): async with AsyncSession() as s: pass @@ -297,7 +297,7 @@ async def test_closed_session_throws_error(): await s.ws_connect("wss://example.com") -# https://github.com/yifeikong/curl_cffi/issues/39 +# https://github.com/lexiforest/curl_cffi/issues/39 async def test_post_body_cleaned(server): async with AsyncSession() as s: # POST with body diff --git a/tests/unittest/test_curl.py b/tests/unittest/test_curl.py index 81464c9a..79019c99 100644 --- a/tests/unittest/test_curl.py +++ b/tests/unittest/test_curl.py @@ -68,7 +68,7 @@ def test_headers(server): headers = json.loads(buffer.getvalue().decode()) assert headers["Foo"][0] == "bar" - # https://github.com/yifeikong/curl_cffi/issues/16 + # https://github.com/lexiforest/curl_cffi/issues/16 c.setopt(CurlOpt.HTTPHEADER, [b"Foo: baz"]) buffer = BytesIO() c.setopt(CurlOpt.WRITEDATA, buffer) @@ -90,7 +90,7 @@ def test_proxy_headers(server): headers = json.loads(buffer.getvalue().decode()) assert "Foo" not in headers - # https://github.com/yifeikong/curl_cffi/issues/16 + # https://github.com/lexiforest/curl_cffi/issues/16 c.setopt(CurlOpt.PROXYHEADER, [b"Foo: baz"]) buffer = BytesIO() c.setopt(CurlOpt.WRITEDATA, buffer) diff --git a/tests/unittest/test_requests.py b/tests/unittest/test_requests.py index 4a6c89bd..556c50af 100644 --- a/tests/unittest/test_requests.py +++ b/tests/unittest/test_requests.py @@ -477,7 +477,7 @@ def test_cookies_with_special_chars(server): assert r.json()["foo"] == "bar space" -# https://github.com/yifeikong/curl_cffi/issues/119 +# https://github.com/lexiforest/curl_cffi/issues/119 def test_cookies_mislead_by_host(server): s = requests.Session(debug=True) s.curl.setopt(CurlOpt.RESOLVE, ["example.com:8000:127.0.0.1"]) @@ -489,7 +489,7 @@ def test_cookies_mislead_by_host(server): assert r.json()["foo"] == "bar" -# https://github.com/yifeikong/curl_cffi/issues/119 +# https://github.com/lexiforest/curl_cffi/issues/119 def test_cookies_redirect_to_another_domain(server): s = requests.Session() s.curl.setopt(CurlOpt.RESOLVE, ["google.com:8000:127.0.0.1"]) @@ -502,7 +502,7 @@ def test_cookies_redirect_to_another_domain(server): assert cookies["foo"] == "google.com" -# https://github.com/yifeikong/curl_cffi/issues/119 +# https://github.com/lexiforest/curl_cffi/issues/119 def test_cookies_wo_hostname_redirect_to_another_domain(server): s = requests.Session(debug=True) s.curl.setopt( @@ -525,7 +525,7 @@ def test_cookies_wo_hostname_redirect_to_another_domain(server): assert cookies["hello"] == "world" -# https://github.com/yifeikong/curl_cffi/issues/39 +# https://github.com/lexiforest/curl_cffi/issues/39 def test_post_body_cleaned(server): s = requests.Session() # POST with body @@ -537,7 +537,7 @@ def test_post_body_cleaned(server): assert r.content == b"" -# https://github.com/yifeikong/curl_cffi/issues/16 +# https://github.com/lexiforest/curl_cffi/issues/16 def test_session_with_headers(server): s = requests.Session() r = s.get(str(server.url), headers={"Foo": "bar"}) @@ -545,7 +545,7 @@ def test_session_with_headers(server): assert r.status_code == 200 -# https://github.com/yifeikong/curl_cffi/pull/171 +# https://github.com/lexiforest/curl_cffi/pull/171 def test_session_with_hostname_proxies(server, proxy_server): proxies = { f"all://{server.url.host}": f"http://{proxy_server.flags.hostname}:{proxy_server.flags.port}" @@ -556,7 +556,7 @@ def test_session_with_hostname_proxies(server, proxy_server): assert r.text == "Hello from man in the middle" -# https://github.com/yifeikong/curl_cffi/pull/171 +# https://github.com/lexiforest/curl_cffi/pull/171 def test_session_with_http_proxies(server, proxy_server): proxies = {"http": f"http://{proxy_server.flags.hostname}:{proxy_server.flags.port}"} s = requests.Session(proxies=proxies) @@ -565,7 +565,7 @@ def test_session_with_http_proxies(server, proxy_server): assert r.text == "Hello from man in the middle" -# https://github.com/yifeikong/curl_cffi/pull/171 +# https://github.com/lexiforest/curl_cffi/pull/171 def test_session_with_all_proxies(server, proxy_server): proxies = {"all": f"http://{proxy_server.flags.hostname}:{proxy_server.flags.port}"} s = requests.Session(proxies=proxies) @@ -574,7 +574,7 @@ def test_session_with_all_proxies(server, proxy_server): assert r.text == "Hello from man in the middle" -# https://github.com/yifeikong/curl_cffi/issues/222 +# https://github.com/lexiforest/curl_cffi/issues/222 def test_closed_session_throws_error(): with requests.Session() as s: pass