Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3630

Zenodo access ["metadata"]["description"]

$
0
0

this piece of code returns records from zenodo with no problem

import requestsimport jsonrecords_api_url = 'https://zenodo.org/api/records'search_query = 'grants.acronym:DIGITAF AND resource_type.type:publication'res = requests.get(records_api_url, params={'q': search_query, 'size': 10000})for i in res.json()["hits"]["hits"]:    print(i["metadata"], "\n" )

returning about 20 hits (dictionaries), one of them, as example here:

{"title": "Agroforestry & the Framework for Certification of Carbon Removals","doi": "10.5281/zenodo.7828353","publication_date": "2022-12-31","description": "<p>Policy Briefing #20 welcomes the draft CRCF, and its initial proposals for robust certification of carbon removals including a) quality criteria, b) verification and certification, c) functioning of certification schemes.&nbsp; However we feel that rigorous certification is only needed for a subset of specialised carbon farming schemes.&nbsp; There is much more to be done, in the near term, to meet the aspirational target of the December 2021 &ldquo;Sustainable Carbon Cycles Communication&rdquo; that &ldquo;by 2028 every land manager should have access to verified emission and removal data&rdquo;.&nbsp; EURAF believes that high quality emissions estimates by Member States (IPCC Tier 3) should be combined with detailed wall-to-wall representation of land use (IPCC Approach 3), and results should be available open source to farmers and foresters.&nbsp; High-resolution databases of net emissions across the forestry and agricultural sectors will facilitate a target of net zero emissions in the integrated land sector by 2035. These improvements by MS should proceed in parallel with amendment and ratification of the CRCF.</p>","access_right": "open","creators": [        {"name": "LAWSON, Gerry","affiliation": "EURAF","orcid": "0000-0002-1395-3092"        }    ],"keywords": ["carbon farming","agroforestry","DigitAF"    ],"version": "1","resource_type": {"title": "Working paper","type": "publication","subtype": "workingpaper"    },"license": {"id": "cc-by-4.0"    },"grants": [        {"code": "101059794","internal_id": "10.13039/501100000780: : 101059794","funder": {"name": "European Commission","doi": "10.13039/501100000780","acronym": "EC"            },"title": "DIGItal Tools to help AgroForestry meet climate, biodiversity and farming sustainability goals: linking field and cloud","acronym": "DIGITAF","program": "HE","url": "https: //cordis.europa.eu/projects/101059794"        }    ],"communities": [        {"id": "euraf"        },        {"id": "eu"        }    ],"relations": {"version": [            {"index": 0,"is_last": True,"parent": {"pid_type": "recid","pid_value": "7828352"                }            }        ]    },"notes": "EURAF Policy Briefing #20"}

I have no problem accessing the title from this dict with

print(i["metadata"]["title"], "\n" )

However, when trying accessing the description with

print(i["metadata"]["description"], "\n" )

returns a "KeyError: 'description'" which is puzzling me. What am I missing?

print(i["metadata"]["title"] # works fineprint(i["metadata"]["doi"] # works fineprint(i["metadata"]["publication_date"] # works fineprint(i["metadata"]["description"] # DOES NOT WORK -> triggers a KeyError: 'description'

Viewing all articles
Browse latest Browse all 3630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>