11# ScreenshotMAX Python SDK
22
3+ [ ![ build] ( https://github.com/screenshotmax/python-sdk/actions/workflows/build.yml/badge.svg )] ( https://github.com/screenshotmax/python-sdk/actions/workflows/build.yml )
34[ ![ test] ( https://github.com/screenshotmax/python-sdk/actions/workflows/test.yml/badge.svg )] ( https://github.com/screenshotmax/python-sdk/actions/workflows/test.yml )
45
56This is the official Python SDK for the [ ScreenshotMAX API] ( https://screenshotmax.com/ ) .
@@ -18,19 +19,23 @@ Use the SDK to generate signed or unsigned URLs for screenshots, PDFs, web scrap
1819### Screenshot example
1920``` python
2021from screenshotmax import SDK
22+ from screenshotmax.enum import ImageFormat
2123from screenshotmax.options import ScreenshotOptions
2224
2325sdk = SDK(" <ACCESS_KEY>" , " <SECRET_KEY>" )
2426
2527# set up options
26- opts = ScreenshotOptions(url = " https://example.com" )
27- sdk.screenshot.set_options(opts)
28+ opts = ScreenshotOptions(
29+ url = " https://example.com" ,
30+ format = ImageFormat.PNG
31+ )
2832
29- # // generate URL (https://api.screenshotmax.com/v1/screenshot?url=https%3A%2F%2Fexample.com&image_width=1280&image_height=720&format=png&image_quality=80&access_key=<ACCESS_KEY>&signature=370f5b161bc59eed13b76........1f778635d7fc595dbab12 )
30- url = sdk.screenshot.get_url ()
33+ # fetch screenshot (chaining method )
34+ result, headers = sdk.screenshot.set_options(opts).fetch ()
3135
32- # generate screenshot
33- result, headers = sdk.screenshot.fetch()
36+ # optionnaly: generate signed URL
37+ # (https://api.screenshotmax.com/v1/screenshot?url=https%3A%2F%2Fexample.com&format=png&access_key=<ACCESS_KEY>&signature=370f5b161bc59eed13b76........1f778635d7fc595dbab12)
38+ url = sdk.screenshot.get_url()
3439```
3540
3641### Web scraping example
0 commit comments