Skip to content

Commit cdc969b

Browse files
authored
Fix Kaggle access token auth KeyError when KAGGLE_API_TOKEN is unset (#874)
fix to #873 ``` del os.environ["KAGGLE_API_TOKEN"] ``` causes keyerror if `KAGGLE_API_TOKEN` is not set, so replaced it with ``` os.environ.pop("KAGGLE_API_TOKEN", None) ```
1 parent 2be71cf commit cdc969b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/kaggle/api/kaggle_api_extended.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ def _authenticate_with_access_token(self):
739739
self.CONFIG_NAME_AUTH_METHOD: AuthMethod.ACCESS_TOKEN,
740740
}
741741
self.logger.debug(f"Authenticated with access token in: {source}")
742-
del os.environ["KAGGLE_API_TOKEN"]
742+
os.environ.pop("KAGGLE_API_TOKEN", None)
743743
return True
744744

745745
def _authenticate_with_oauth_creds(self) -> bool:

0 commit comments

Comments
 (0)