I am trying to create a plugin for some larger construction Software to pull data from a public Rest API into the Software. When trying to get the data with
r = requests.get(self.Server + "/merkmale/api/v1/public/filter")
i constantly get a
File "C:\ProgramData\Nemetschek\Allplan\2024\Etc\PythonParts-site-packages\urllib3\util\timeout.py", line 152, in _validate_timeout
raise ValueError(
ValueError: Timeout value connect was _TYPE_DEFAULT.token, but it must be an int, float or None.
Error Message. I managed to gether a respone once but could not make it repetitive. Am i missing out on some "clean-up"?
Currently i use requests 2.32.3 and urllib3 2.3.0
Tiny disclamer, I am new to python and a engineering student, so sorry if I just overlook something unknowingly.
I have tried:
get(Server, timeout=5)
Timeout(5,5)
get(self.Server+"/merkmale/api/v1/public/filter", timeout=Timeout)
urllib3
and requests
because i found some breadcrumbs on github that this might help.It should normally return a JSON response which i want to then load as dict for further use.
See the API here, its in German though: https://bimdeutschland.github.io/BIM-Portal-REST-API-Dokumentation/#/Merkmalsgruppen/get_merkmale_api_v1_public_propertygroup__guid_
Seems like your machine is blocking the ip. Try to open the firewall for open network. Becuase the same code works for me.
requests package version : 2.32.3
Code used:
import requests
# Example: Set a timeout of 5 seconds for both connect and read
response = requests.get("https://via.bund.de/bim/merkmale/api/v1/public/filter")
#print(response.json())
print(response.status_code)
Output:
200
Below is the code to find ip address.Make sure that this is not blocked in your ip range. Because it clearly works for me.I validated by printing the json too.
import socket
from urllib.parse import urlparse
# Parse the domain from the URL
url = "https://via.bund.de/bim/merkmale/api/v1/public/filter"
parsed_url = urlparse(url)
hostname = parsed_url.hostname
# Resolve the IP address
try:
ip_address = socket.gethostbyname(hostname)
print(f"The IP address of {hostname} is {ip_address}")
except socket.gaierror as e:
print(f"Error resolving the IP address: {e}")
Output :
The IP address of via.bund.de is 141.17.30.45