Python

GitHub

import hmac
from hashlib import sha256
 
try:
  from urllib import urlencode
except ImportError:
  from urllib.parse import urlencode
 
def webscreenshot_generate_image_url(args):
  apiKey = "YOURAPIKEY"
  apiSecret = "YOURAPISECRET"
  queryString = urlencode(args, True)
  hmacToken = hmac.new(str.encode(apiSecret), str.encode(queryString), sha256)
  token = hmacToken.hexdigest().rstrip('\n')
  return "http://api.webscreenshot.io/v1/%s/%s/png?%s" % (apiKey, token, queryString)
 
argsDict = {'page' : "https://google.com", 'height': 800, 'width': 600}
print(webscreenshot_generate_image_url (argsDict))