Skip to content

Instantly share code, notes, and snippets.

@danvine
Created November 6, 2013 05:26
Show Gist options
  • Save danvine/7331362 to your computer and use it in GitHub Desktop.
Save danvine/7331362 to your computer and use it in GitHub Desktop.
import urllib
import hashlib
class Url2png(object):
def __init__(self, options):
self.apikey = 'PXXXX'
self.secret = 'SXXXX'
self.query_string = urllib.urlencode(options)
self.token = hashlib.md5(self.query_string + self.secret).hexdigest()
@property
def url(self):
return "http://api.url2png.com/v6/%s/%s/png/?%s" % (self.apikey, self.token, self.query_string)
options = {
'url': "http://www.google.com",
'viewport': "1024x768",
'thumbnail_max_width': 200,
}
print Url2png(options).url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment