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
Parameter | Default | Description |
---|---|---|
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 .
|
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 hashes)