'KeyError: 'apikey'

This is what the code is but getting keyerror "apikey"

class Firebase: """ Firebase Interface """ def init(self, config):

    self.api_key = config["apikey"]
    self.auth_domain = config["authDomain"]
    self.database_url = config["databaseURL"]
    self.storage_bucket = config["storageBucket"]
    self.credentials = None
    self.requests = requests.Session()
    if config.get("serviceAccount"):
        scopes = [
            'https://www.googleapis.com/auth/firebase.database',
            'https://www.googleapis.com/auth/userinfo.email',
            "https://www.googleapis.com/auth/cloud-platform"
        ]
        service_account_type = type(config["serviceAccount"])
        if service_account_type is str:
            self.credentials = ServiceAccountCredentials.from_json_keyfile_name(config["serviceAccount"], scopes)
        if service_account_type is dict:
            self.credentials = ServiceAccountCredentials.from_json_keyfile_dict(config["serviceAccount"], scopes)
    if is_appengine_sandbox():
        # Fix error in standard GAE environment
        # is releated to https://github.com/kennethreitz/requests/issues/3187
        # ProtocolError('Connection aborted.', error(13, 'Permission denied'))
        adapter = appengine.AppEngineAdapter(max_retries=3)
    else:
        adapter = requests.adapters.HTTPAdapter(max_retries=3)

    for scheme in ('http://', 'https://'):
        self.requests.mount(scheme, adapter)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source