a_frame/utils/action_providers/GitAction.py
def connect_to_oauth2(self):
        """
        connects to OAuth2 with the specified user and password

        :return: boolean if successful

        """

        _auth_json = """
            { "grant_type": "password",
              "username": "%s",
              "password": "%s"
            }
            """ % (self.username, self.password)

        full_url = self.protocol + "://" + self.host + self._oauth2_auth_path
        print full_url
        request = urllib2.Request(full_url)

        print "OAuth2 using username/password: %s %s" % (self.username, self.password)
        base64string = base64.b64encode("%s:%s" % (self.username, self.password))
        request.add_header("Authorization", "Basic %s" % base64string)
        request.add_header("Content-Type", "application/json")

        if hasattr(ssl, 'SSLContext'):
            context = ssl.create_default_context()  # disables SSL cert checking!
            context.check_hostname = False
            context.verify_mode = ssl.CERT_NONE
            result = urllib2.urlopen(request, _auth_json, context=context).read()
        else:
            result = urllib2.urlopen(request, _auth_json).read()

        try:
            json_string = json.loads(result)
            print "Found OAuth2 JSON result"
        except ValueError:
            print "Unknown OAuth2 result!"
            return False

        if not json_string["token_type"] or not json_string["access_token"]:
            return False

        self._auth_token = json_string["token_type"] + " " + json_string["access_token"]
        return True

        connects to OAuth2 with the specified user and password

        :return: boolean if successful

        
connects to OAuth2 with the specified user and password
connects to OAuth2 with the specified user and password
def connect_to_oauth2(self):
        _auth_json = """
            { "grant_type": "password",
              "username": "%s",
              "password": "%s"
            }
            """ % (self.username, self.password)
        full_url = self.protocol + "://" + self.host + self._oauth2_auth_path
        print full_url
        request = urllib2.Request(full_url)
        print "OAuth2 using username/password: %s %s" % (self.username, self.password)
        base64string = base64.b64encode("%s:%s" % (self.username, self.password))
        request.add_header("Authorization", "Basic %s" % base64string)
        request.add_header("Content-Type", "application/json")
        if hasattr(ssl, 'SSLContext'):
            context = ssl.create_default_context()  
            context.check_hostname = False
            context.verify_mode = ssl.CERT_NONE
            result = urllib2.urlopen(request, _auth_json, context=context).read()
        else:
            result = urllib2.urlopen(request, _auth_json).read()
        try:
            json_string = json.loads(result)
            print "Found OAuth2 JSON result"
        except ValueError:
            print "Unknown OAuth2 result!"
            return False
        if not json_string["token_type"] or not json_string["access_token"]:
            return False
        self._auth_token = json_string["token_type"] + " " + json_string["access_token"]
        return True
def connect_to_oauth2 ( self ) : _auth_json = """
            { "grant_type": "password",
              "username": "%s",
              "password": "%s"
            }
            """ % ( self . username , self . password ) full_url = self . protocol + "://" + self . host + self . _oauth2_auth_path print full_url request = urllib2 . Request ( full_url ) print "OAuth2 using username/password: %s %s" % ( self . username , self . password ) base64string = base64 . b64encode ( "%s:%s" % ( self . username , self . password ) ) request . add_header ( "Authorization" , "Basic %s" % base64string ) request . add_header ( "Content-Type" , "application/json" ) if hasattr ( ssl , 'SSLContext' ) : context = ssl . create_default_context ( ) context . check_hostname = False context . verify_mode = ssl . CERT_NONE result = urllib2 . urlopen ( request , _auth_json , context = context ) . read ( ) else : result = urllib2 . urlopen ( request , _auth_json ) . read ( ) try : json_string = json . loads ( result ) print "Found OAuth2 JSON result" except ValueError : print "Unknown OAuth2 result!" return False if not json_string [ "token_type" ] or not json_string [ "access_token" ] : return False self . _auth_token = json_string [ "token_type" ] + " " + json_string [ "access_token" ] return True
connects to OAuth2 with the specified user and password
connects to OAuth2 with the specified user and password
"""
        connects to OAuth2 with the specified user and password

        :return: boolean if successful

        """ # disables SSL cert checking!
boolean if successful
boolean if successful
self