Closed jdrescher2006 closed 6 years ago
I started with converting to urllib. First step is requesting landing page and get CSFR:
try:
response = urllib.urlopen(base + '/portal/en_GB/web/guest/home')
except urllib.error.HTTPError as e:
print('HTTPError: {}'.format(e.code))
return 0
except urllib.error.URLError as e:
print('URLError: {}'.format(e.reason))
return 0
print('Request OK!')
csrf = extract_csrf(response.read())
print(csrf)
This works, i get for example: Ua5jtvrj
Next step is request login page:
data = urllib.urlencode({'headers': AUTHHEADERS})
data = data.encode('ascii')
response = urllib.urlopen(base + '/portal/web/guest/home/-/csrftokenhandling/get-login-url', data)
print response.read()
Unfortunately this returns a html web page and not a json file as your code does. What could be the problem?
OK, I got the requests library running on my system. So I will close this.
I don't have the requests library available on my system. Is it possible to do the same with only urllib?