[Python] manually authenticate kaggle api

Discussão em 'Python' iniciado por Stack, Junho 22, 2025.

  1. Stack

    Stack Membro Participativo

    One of these combinations should work for setting the account info to download a kaggle dataset. Placing the json file in azure isn't working so was trying this

    import kaggle
    api=kaggle.KaggleApi()
    api.CONFIG_NAME_USER='abc'
    api.CONFIG_NAME_KEY='xyz'
    api.read_config_environment({"username":"abc","key":"xyz"})
    api.authenticate()
    api.competition_download_files('dataset_name')


    EDIT: This is source and I'be tried setting all of these variables manually

    config_data = self.read_config_environment(config_data)

    # Step 2: if credentials were not in env read in configuration file
    if self.CONFIG_NAME_USER not in config_data \
    or self.CONFIG_NAME_KEY not in config_data:
    if os.path.exists(self.config):
    config_data = self.read_config_file(config_data)
    else:
    raise IOError('Could not find {}. Make sure it\'s located in'
    ' {}. Or use the environment method.'.format(
    self.config_file, self.config_dir))

    Continue reading...

Compartilhe esta Página