Skip to main content

No project description provided

Project description

Groove

Python APIs for Groove, a proxy server built for web crawling and unit test mocking. Highlights of its primary features:

  • HTTP and HTTPs support over HTTP/1 and HTTP/2.
  • Local CA certificate generation and installation on Mac and Linux to support system curl and Chromium.
  • Different tiers of caching support - from disabling completely to aggressively maintaining all body archives.
  • Limit outbound requests of the same URL to 1 concurrent request to save on bandwidth if requests are already inflight.
  • Record and replay requests made to outgoing servers. Recreate testing flows in unit tests while separating them from crawling business logic.
  • 3rd party proxy support for commercial proxies.
  • Custom TLS Hello Client support to maintain a Chromium-like TLS handshake while intercepting requests and re-forwarding on packets.

For more information, see the Github project.

Usage

Add groove to your project and install the local certificates that allow for https certificate generation:

pip install groove
install-ca

Instantiating Groove with the default parameters is usually fine for most deployments. To ensure we clean up resources once you're completed with the proxy, wrap your code in the launch contextmanager.

from groove.proxy import Groove
from requests import get

proxy = Groove()
with proxy.launch():
    response = get(
        "https://www.example.com",
        proxies={
            "http": proxy.base_url_proxy,
            "https": proxy.base_url_proxy,
        }
    )
    assert response.status_code == 200

Create a fully fake outbound for testing:

from groove.proxy import Groove
from requests import get

records = [
    TapeRecord(
        request=TapeRequest(
            url="https://example.com:443/",
            method="GET",
            headers={},
            body=b"",
        ),
        response=TapeResponse(
            status=200,
            headers={},
            body=b64encode("Test response".encode())
        ),
    )
]

proxy = Groove()
with proxy.launch():
    proxy.tape_load(
        TapeSession(
            records=records
        )
    )

    response = get(
        "https://www.example.com",
        proxies={
            "http": proxy.base_url_proxy,
            "https": proxy.base_url_proxy,
        }
    )
    assert response.content == b"Test response"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

groove-0.1.1.tar.gz (27.3 kB view details)

Uploaded Source

Built Distributions

groove-0.1.1-cp310-cp310-manylinux_2_31_x86_64.whl (11.3 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

groove-0.1.1-cp310-cp310-macosx_10_16_x86_64.whl (11.3 kB view details)

Uploaded CPython 3.10 macOS 10.16+ x86-64

File details

Details for the file groove-0.1.1.tar.gz.

File metadata

  • Download URL: groove-0.1.1.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.7 Linux/5.15.0-1020-azure

File hashes

Hashes for groove-0.1.1.tar.gz
Algorithm Hash digest
SHA256 71926772157421a20bb8907ff03545993674aea15e41c174aea3438525d9060e
MD5 6d84abff35827e60d39ee26fce595607
BLAKE2b-256 c48fce94356b28303a0731536a59500486d25790b3d35cd93686a877dc306a3e

See more details on using hashes here.

File details

Details for the file groove-0.1.1-cp310-cp310-manylinux_2_31_x86_64.whl.

File metadata

  • Download URL: groove-0.1.1-cp310-cp310-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.7 Linux/5.15.0-1020-azure

File hashes

Hashes for groove-0.1.1-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 feca373d07fe99600d27d83ddaac1b2f50373a669bd839f9044f28f33c957e84
MD5 f5c39508371cb492ec6f561100e428f0
BLAKE2b-256 eee056b39509780eb6c6d0f81ebe80c36de55e8243483eb1a55a2a395d2656ca

See more details on using hashes here.

File details

Details for the file groove-0.1.1-cp310-cp310-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for groove-0.1.1-cp310-cp310-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 801b2a6abd719fa1783d9655b8a7eb70db8b05e09e123a5f7e92960c34dee5b9
MD5 cb5b534dc7a51c20375b256f42a79a99
BLAKE2b-256 59d7d69bb6b6ee9428360bdd1df0c4d33678915bd89c2443d0724da622ab914c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page