nkasmanoff commited on
Commit
fb6da00
1 Parent(s): 8ac2414

Update helpers.py

Browse files
Files changed (1) hide show
  1. helpers.py +16 -1
helpers.py CHANGED
@@ -47,4 +47,19 @@ def get_dataset_metadata(dataset_url):
47
  if key in response_json:
48
  retrieved_metadata[key] = response_json[key]
49
 
50
- return retrieved_metadata
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  if key in response_json:
48
  retrieved_metadata[key] = response_json[key]
49
 
50
+ return retrieved_metadata
51
+
52
+
53
+ def get_dataset_readme(dataset_url):
54
+ retrieved_metadata = {}
55
+ metadata_url = check_api_url(dataset_url)
56
+ readme_url = dataset_url + '/raw/main/README.md'
57
+ readme_response = requests.get(readme_url)
58
+ metadata_response = requests.get(metadata_url)
59
+ if readme_response.status_code == 200:
60
+ response_text = readme_response.text
61
+ dataset_id = metadata_response.json()['id']
62
+ retrieved_metadata = {'id': dataset_id, 'README': response_text}
63
+
64
+ return retrieved_metadata
65
+