mardi 30 novembre 2021

Python use API to get data

I am kind of stucked in trying to solve following issue: I try to access a web-page in order to get some data for a supplier (need to do it for work) in an automated way, using an api

The API is called https://wl-api.mf.gov.pl and shall provide information stored in json for supplier which can be found over their tax ID.

I use the request package and I am able to manage to get positive response:

import requests
nip=7393033097
response=requests.get("https://wl-api.mf.gov.pl")
print(response) --> Response [200]

If I click on the link and scroll until I find the specific part for the tax information, I find the following line

GET /api/search/nip/{nip}

So what I did is to add this line into my response variable, since this is how I understood it - and there is the point where I think I am wrong

response=requests.get("https://wl-api.mf.gov.pl/search/7393033097/{7393033097}")

However, I cannot access it. Am I doing something wrong - I do believe yes - and can anyone give me a little help :)

Update: If I check the requirements / documentation I find following information where I need a bit support to implement it

GET /api/search/nip/{nip}

(nip?date)
Single entity search by nip

**Path parameters**
nip (required)
*Path Parameter — Nip*

**Query parameters**
date (required)
*Query Parameter — format: date*

**Return type**
EntityResponse
Example data
Content-Type: application/json



Aucun commentaire:

Enregistrer un commentaire