ich bin sehr unerfahren mit Python und stieß zeimlich früh auf folgendes Problem:
Ich möchte gern einen login durchführen um anschließend den dahinterliegende Webseite auszulesen.
Mein Code dazu sieht folgendermaßen aus:
Code: Alles auswählen
import requests
import urllib3
import certifi
import ssl
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
http = urllib3.PoolManager(
cert_reqs='CERT_REQUIRED', # Force certificate check.
ca_certs=certifi.where(), # Path to the Certifi bundle.
)
# Fill in your details here to be posted to the login form.
payload = {
'username': 'user1test',
'password': 'passwort1test'
}
url = 'www.beispiel.de'
r = requests.post(url, data=payload, verify=False, headers={'Content-Type': 'application/json', 'Accept':'application/json'})
print(r.text)
{"status-code":500,"message":"Unexpected character ('p' (code 112)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@12fa06b6; line: 1, column: 2]"}
Damit kann ich überhaupt nichts anfangen.
Weiß vielleicht jemand von euch was das Problem ist?
Vielen Dank