Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bundesbank API Problems
#1
Hello,

So far I'm 0/2 on APIs. I am a beginner but I keep running into problems with APIs.

The German Bundesbank provides an API and the documentation. They clearly write out how to make an API request https://www.bundesbank.de/en/statistics/...rface-data and so I take the flowRef and key from here https://www.bundesbank.de/dynamic/action...0.R.I&id=0 and this is what I get:

url = 'https://api.statistiken.bundesbank.de/rest'
params = {
    'flowRef':'BBKRT',
    'key':'M.DE.Y.P.PC1.PC100.R.I',
}

req = requests.get(url, params=params)
But for whatever reason I get a 404 and I don't know why. In this service page https://api.statistiken.bundesbank.de/do...umentation where you can manually write out the get requests when I use the flowRef and key, it locates the data but it gives me 404 when I do it on python.

I'm sure this is an easy fix for anyone with experience in using APIs. I would appreciate the help.

Matt
Reply
#2
import requests
	
flow_ref ='BBKRT'
key = 'M.DE.Y.P.PC1.PC100.R.I'

req = requests.get(f'https://api.statistiken.bundesbank.de/rest/data/{flow_ref}/{key}')
print(req.text)
req.text is a XML
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Thank you. That did the trick.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020