def request_credentials(self, access_rules, redirect_url=None):
        """Request a Consumer Key to the API.

        That key will need to be validated with the link
        returned in the answer.

        :param access_rules: list of dictionaries listing the
         accesses your application will need. Each dictionary
         must contain two keys : method, of the four HTTP methods,
         and path, the path you will need access for,
         with * as a wildcard
        :param redirect_url: url where you want the user to be
         redirected to after he successfully validates
         the consumer key

        :raises APIError: Error send by api
        """
        target_url = self.base_url + "/auth/credential"
        params = {"accessRules": access_rules}
        params["redirection"] = redirect_url
        query_data = json.dumps(params)
        q = requests.post(
            target_url,
            headers={
                "X-Ra-Application": self.application_key,
                "Content-type": "application/json"
            },
            data=query_data)
        res = json.loads(q.text)
        if q.status_code < 100 or q.status_code >= 300:
            raise APIError(res['message'])
        self.consumer_key = str(res['consumerKey'])
        return res
dataset/ETHPy150Open runabove/python-runabove/runabove/wrapper_api.py/WrapperApi.request_credentials/original