as it can be seen I have written the "api_token" in the Jason file by the dump.
!pip install kaggle
!mkdir .kaggle
!touch .kaggle/kaggle.json
api_token = {"username":"x","key":"bber45dmn87hg35d9kjh65f5f8fnhgtr5"}
import json
import zipfile
import os
with open('/root/.kaggle/kaggle.json', 'w') as file:
json.dump(api_token, file)
!chmod 600 /root/.kaggle/kaggle.json
!pip install kaggle
!kaggle datasets init -p Music/
!cat Music/dataset-metadata.json
the output results are as follows:
{
"title": "INSERT_TITLE_HERE",
"id": "x/INSERT_SLUG_HERE",
"licenses": [
{
"name": "CC0-1.0"
}
]
}
Now i have no idea about how I can edit the content of "dataset-metadata.json" file? In other words, I want to edit the value of "title" from "INSERT_TITLE_HERE" to My_name" and also change the value of "id" from "x/INSERT_SLUG_HERE" to x/My_name. Should I do it via dump or there is any other solutions?
Any answers will be appreciated.
You can use %%writefile magic in Colab.
%%writefile Music/dataset-metadata.json
{
"title": "My Title",
"id": "x/MY_SLUG",
"licenses": [
{
"name": "CC0-1.0"
}
]
}