Skip to content

Instantly share code, notes, and snippets.

@tonetheman
Created September 23, 2013 19:53
Show Gist options
  • Select an option

  • Save tonetheman/6675996 to your computer and use it in GitHub Desktop.

Select an option

Save tonetheman/6675996 to your computer and use it in GitHub Desktop.
win7x64 FF22 screenshot APIv2
# pound at the front of a line is a comment
# just making sure you know!
# your string
link_address_string = "http://www.sciencedirect.com/science/article/pii/B9780122197406500009/pdfft?md5=a05b1f606da85a80419c6fd7d5f614bf&pid=3-s2.0-B9780122197406500009-main.pdf"
# did not really need this
import urllib
# API stuff
url_string = "http://crossbrowsertesting.com/api/v2/screenshots/run"
AUTH = ("YOURUSERNAME", "YOURPASSWORD")
# python module to handle making URL requests
import requests
# tried the screenshot on both of these
# "browsers" : "Ubuntu11.10|Chrome16"
# "browsers" : "Win7x64-C1|FF22"
# this only runs the win7x64 firefox 22 one
data = { "url" : link_address_string,
"format" : "xml",
"browsers" : "Win7x64-C1|FF22"
}
# do the POST here
r = requests.post(url_string, auth=AUTH, params = data)
# print out the gunk back from us! it is good gunk :)
o = r.text
print o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment