Skip to main content

ApiFlash.com Client

The ApiFlash Client is a Python module for interacting with apiflash. It requires Python 3.7+.

Installation

In a Python virtual environment:

$ pip install apiflash-client

Example usage

Setup a client:

from apiflash import ApiFlashClient

access_key = '<your-access-key>'

client = ApiFlashClient(access_key)

Check the quota of your account:

print(client.quota())

Capture a screenshot of a URL:

resp = client.capture(
    'https://google.com',
)
print(resp['url'])

Capture a screenshot of a URL with some parameters:

from apiflash import ImageFormat

resp = client.capture(
    'https://google.com',
    width=400,
    height=600,
    format=ImageFormat.WEBP,
)
print(resp['url'])

Capture a screenshot of a URL, but return the image data, rather than a screentshot URL:

from apiflash import ResponseType

data = client.capture(
    'https://google.com',
    response_type=ResponseType.IMAGE,
)

with open('my-file.png', 'wb') as filehandle:
    filehandle.write(data)

All available capture options can be found here.

Command line usage

Once installed in your virtual environment, you can use the command line interface. You will need to pass --access-key <your-access-key> or set APIFLASH_ACCESS_KEY in your environment for the command line to authenticate with apiflash.com:

$ apiflash quota
{'limit': 100, 'remaining': 91, 'reset': 1703265314}

$ apiflash capture https://google.com
https://api.apiflash.com/v1/urltoimage/cache/8jzv236knw.png?access_key=<your-access-key>

$ apiflash capture https://google.com -o width 400 -o height 600
https://api.apiflash.com/v1/urltoimage/cache/5asdf65asd.png?access_key=<your-access-key>

If you are using ngrok to expose a local development environment, you will need to pass -o headers ngrok-skip-browser-warning=yes to the command line utility. The same can be passed as a keyword argument to the capture() method, if retrieving the screenshot programmatically.

Metadata

Release files for apiflash-client 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apiflash-client 0.2
File Size Uploaded Provenance
apiflash-client-0.2.tar.gz 5.9 kB Without provenance Details

Release files / apiflash-client-0.2.tar.gz

Download URL apiflash-client-0.2.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5362f6a37d419beb891006b485ddc0bcb2716b008f3d5845e4b0fc891f9dabd7
BLAKE2b-256 checksum
How to use checksums
49e20958bcd1fd9d3ef1fe10f999b4359bea28ee0e36a0ff43e90a7e993f34d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for apiflash-client 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page