damian0604 / bdaca

Course Materials Big Data and Automated Content Analysis
69 stars 22 forks source link

manifesto project api as other example #74

Open damian0604 opened 5 years ago

damian0604 commented 5 years ago

https://manifesto-project.wzb.eu/information/documents/api

damian0604 commented 5 years ago

need to create account and api key, then it is straightforward:


In [1]: import requests

In [2]: mykey = "43216759be93XXXXXXXXXXXXXXXXXXXXXXX"    # put your key from your profile page here

In [3]: data = requests.get("https://manifesto-project.wzb.eu/tools/api_list_core_versions.json?api_key={}".format(mykey))

In [4]: data
Out[5]: <Response [200]>

In [5]: datadict = data.json()

In [6]: type(datadict)
Out[7]: dict

In [7]: datadict.keys()
Out[8]: dict_keys(['datasets'])