def __init__(self, google_email=None, google_password=None, path='/accounts/ClientLogin'): authtoken_pat = re.compile(r"Auth=(.*)") if google_email == None or google_password == None: google_email, google_password = config.get_google_credentials() data = "accountType=HOSTED_OR_GOOGLE&Email=%s&Passwd=%s&service=analytics&source=%s" data = data % (google_email, google_password, self.user_agent) if DEBUG: print "Authenticating with %s / %s" % (google_email, google_password) response = self.make_request('POST', path=path, data=data) auth_token = authtoken_pat.search(response.read()) self.auth_token = auth_token.groups(0)[0]
def __init__(self, google_email=None, google_password=None): authtoken_pat = re.compile(r"Auth=(.*)") path = '/accounts/ClientLogin' if google_email == None or google_password == None: google_email, google_password = config.get_google_credentials() data = "accountType=GOOGLE&Email=%s&Passwd=%s&service=analytics&source=%s" data = data % (google_email, google_password, self.user_agent) if DEBUG: print "Authenticating with %s / %s" % (google_email, google_password) response = self.make_request('POST', path=path, data=data) auth_token = authtoken_pat.search(response.read()) self.auth_token = auth_token.groups(0)[0]
def __init__(self, google_email=None, google_password=None): authtoken_pat = re.compile(r"Auth=(.*)") path = '/accounts/ClientLogin' if google_email == None or google_password == None: google_email, google_password = config.get_google_credentials() data = { 'accountType': 'GOOGLE', 'Email': google_email, 'Passwd': google_password, 'service': 'analytics', 'source': self.user_agent, } if DEBUG: print("Authenticating with %s / %s" % (google_email, google_password)) response = self.make_request('POST', path=path, data=data) auth_token = authtoken_pat.search(response.text) self.auth_token = auth_token.groups(0)[0]
def __init__(self, google_email=None, google_password=None, api_key=None, timeout=10): self._timeout = timeout authtoken_pat = re.compile(r"Auth=(.*)") base_url = 'https://www.google.com' path = '/accounts/ClientLogin' self._api_key = api_key if not all([google_email, google_password, self._api_key]): google_email, google_password, self._api_key = config.get_google_credentials() data = { 'accountType': 'GOOGLE', 'Email': google_email, 'Passwd': google_password, 'key': self._api_key, 'service': 'analytics', 'source': self.user_agent } response = self.make_request('POST', base_url, path, data=data) auth_token = authtoken_pat.search(response.read()) self.auth_token = auth_token.groups(0)[0]