Created
November 22, 2013 11:16
-
-
Save akshay-bhardwaj/7598338 to your computer and use it in GitHub Desktop.
ScreenShot Parsing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import base64 | |
USERNAME = "" | |
BROWSERSTACK_KEY = "" | |
BUILD = "" | |
SESSION = "" | |
def get_screen_shot(BUILD, SESSION): | |
req = urllib2.Request('https://www.browserstack.com/automate/builds/%s/sessions/%s/logs.json'%(BUILD, SESSION)) | |
base64string = base64.encodestring('%s:%s' % (USERNAME, BROWSERSTACK_KEY)).replace('\n','') | |
req.add_header("Authorization", "Basic %s" % base64string) | |
opener = urllib2.build_opener() | |
reader = opener.open(req) | |
response = reader.read() | |
response_list = response.split('\r\n') | |
for line in response_list: | |
split_data = line.split(' ') | |
if len(split_data) >= 4 and split_data[2] == 'DEBUG': | |
print split_data[3] | |
get_screen_shot(BUILD, SESSION) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment