Have a look at https://www.tutorialspoint.com/downloading-files-from-web-using-python
and
Add layer to map in qgis3 via a python script
As the first part of your question was really about Python -it was important to search without QGIS in your search. The 2nd part was about QGIS but was just about loading data.
The code below is from the two answers above. I am just pointing this out to you as a new user on this platform so that you can get more value from it.
In your case in the python window, it's just
import requests
from qgis.core import QgsVectorLayer, QgsProject
Set variables
url = 'https://www.landesdatenbank.nrw.de/ldbnrwws/rest/2020/data/table?username=LD001583%20&password=N0key1993!&name=19321-108i&area=all&compress=false&transpose=false&startyear=&endyear=×lices=®ionalvariable=®ionalkey=&classifyingvariable1=GEMEIN&classifyingkey1=05766020&classifyingvariable2=&classifyingkey2=&classifyingvariable3=&classifyingkey3=&job=false&Stand=30.06.2019&language=de'
downloaded_file = 'c:/temp/test.txt'
file_name = 'test'
No more changes required
r = requests.get(url, allow_redirects=True)
#Import data based on url above.
open(downloaded_file, 'wb').write(r.content)
#Add imported data into QGIS
layer = QgsVectorLayer(downloaded_file, file_name, "ogr")
print(layer.isValid())
QgsProject.instance().addMapLayer(layer)
I am not sure what file type the downloaded file is, so just change test.txt and the path to whatever you need. You may also need to remove the first line or some other parts of the downloaded file to make it into an OGR readable dataset.
False" Beside it has a Error in this Layer, it said:"Layer's Data is not found". I am really confused with this Error, maybe this Data is not really good to add in QGIS
– AnAn Dec 05 '21 at 02:20