Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: last-modified in kaggle_api_extended.py #513

Open
prabhanjan-jadhav opened this issue Oct 28, 2023 · 3 comments
Open

KeyError: last-modified in kaggle_api_extended.py #513

prabhanjan-jadhav opened this issue Oct 28, 2023 · 3 comments

Comments

@prabhanjan-jadhav
Copy link

prabhanjan-jadhav commented Oct 28, 2023

This line of code (1829-1830):
remote_date = datetime.strptime(response.headers['Last-Modified'], '%a, %d %b %Y %H:%M:%S %Z')
in kaggle/api/kaggle_api_extended.py tries to access non-existent key "last-modified" from responses.headers.

kaggle version: 1.5.16

@Philmod
Copy link
Contributor

Philmod commented Nov 2, 2023

What is the API command I can use to reproduce this problem?

@malharpandya
Copy link

I can confirm that the issue still persists, and modifying the function locally with the change in the PR fixes the issue.

Sample script to reproduce the error:

import os
from kaggle.api.kaggle_api_extended import KaggleApi

# set up environment variables (now we don't need kaggle.json)
os.environ["KAGGLE_USERNAME"] = "username" # replace with account username
os.environ["KAGGLE_KEY"] = "key" # replace with generated token

# Initialize and authenticate
api = KaggleApi()
api.authenticate()

"""FETCH"""
competitions = ["llm-detect-ai-generated-text", "blood-vessel-segmentation", "UBC-OCEAN"] # sample competitions
for comp in competitions:
    api.competition_leaderboard_download(competition=comp, path=None)

@dexhunter
Copy link

still face this problem when running kaggle competitions leaderboard playground-series-s4e10 -d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants