Skip to main content

The official python client of ApiFlash, website screenshot API.

Project description

ApiFlash Python Client

Easily capture website screenshots using the ApiFlash website screenshot API.

Signup at apiflash.com to get your API key.

Installation

pip install apiflash

Example

# TODO
print('ok')

Parameters

ParameterDefaultDescription
access_key Your personal access key to use the API. You can find it in your dashboard.
url The URL of the website you want to request a snapshot from. The protocol (http:// or https://) must be specified for the URL to be valid.
ttl 86400 The number of seconds the screenshot should be kept in cache. When a screenshot is served from cache, the API call doesn't count in your monthly credit. From 0 to 2592000 (30 days) seconds.
fresh False Return a fresh new screenshot instead of the eventually cached one.
full_page False Set this to true if you want to capture the full height of the target website.
scroll_page False Set this to true if you want the page to be scrolled through to trigger animations or lazy loaded elements.
width 1920 Width of the viewport to use.
height 1080 Height of the viewport to use. This will be ignored if full_page is set to true.
delay 0 Delay, after the pageload event is fired, to wait before taking the screenshot. From 0 to 10 seconds. Most websites are fully loaded after the pageload event so this parameter is not needed most of the time.
format jpeg The format of the returned screenshot. One of jpeg and png.
response_type image The type of response to return. Can be either image or json.
  • If the response type is image, the binary data of the screenshot is returned with the appropriate Content-Type and Content-Length headers.
  • If the response type is json, the response is a json document. formatted as follows:
    {
        "url": "https://url_of_screenshot_image...",
        "extracted_html": "https://url_of_extracted_html_here..."
    }
quality 80 The quality of the image between 0 and 100. This only works with the jpeg format.
transparent False Hides the default background and allows capturing screenshots with transparency. This only works with the png format.
css An additional CSS string to be injected into the page before capturing. The CSS string might need to be URL encoded to be processed correctly.
js Additional JavaScript code to be injected into the page before capturing. For security reasons, this feature is disabled by default for all accounts. If you need it, please let us know. The JS string might need to be URL encoded to be processed correctly.
extract_html False Extract the HTML of the page at the same time the screenshot is made. This only works when the response_type parameter is set to json. When this parameter is set to true, an extracted_html attribute is added to the returned json document.
accept_language Sets an Accept-Language header on requests to the target URL allowing you to make screenshots of a website with a specific language.
user_agent Sets the User-Agent header to emulate a particular client when making screenshots.
location A country location to use when emulating geo-location. ISO alpha-2 and ISO alpha-3 country codes are supported.
latitude The latitude to use when emulating geo-location between -90 and 90.
longitude The longitude to use when emulating geo-location between -180 and 180.
accuracy 0 Accuracy value to use when emulating geo-location.
fail_on_status A comma separated list of HTTP status codes that should make the API call fail instead of returning a screenshot. Hyphen separated HTTP status codes can be used to define ranges. For example 400,404,500-511 would make the API call fail if the URL returns 400, 404 or any status code between 500 and 511.

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

apiflash-0.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

apiflash-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apiflash-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for apiflash-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b8d5a4bb4a4fc9dbf90f11706448cdc2a1b4f8ac8b2aed846faf7239094876e8
MD5 4281b21aba009536220765fb388c7320
BLAKE2b-256 b53f58a1c0a12d41edd1418dc30e49881e5e8f400a59e02db13349b238f16ca0

See more details on using hashes here.

File details

Details for the file apiflash-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: apiflash-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for apiflash-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f39cd2db1160a4abe870d7e1e743e0bed5b12798b57e749f40c6c6db348ac246
MD5 e0d32bda841eeab923ca3673c9b09758
BLAKE2b-256 c42289df684d0354fc49c4f171c7cd3da6346cd4dca3c6d4c55f2c3d37b81966

See more details on using hashes here.

Supported by

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