I tried to use login code with python via api and it gives me following error:
Notice: Undefined index: api_token in /var/www/html/opencart/catalog/controller/startup/session.php on line 8Notice: Undefined index: username in /var/www/html/opencart/catalog/controller/api/login.php on line 11Notice: Undefined index: key in /var/www/html/opencart/catalog/controller/api/login.php on line 11
What changes should i make?
Code: Select all
import requests
s = requests.Session()
username = 'Default'
key='43U3dt1zhgpX7Qgt8hKIDzDhbRFeMmxFkijgi6MymABWT8HX6lw0zOM2aTfAfx3lPpbhDaTZsdv47PXNvb7f8CBK7lvs3G1di4GnMEj777ysWVZwdKNlx6pZ70cV0s4qZAtqBgMr5QgxQkkNFnngoNHpEtWN0lZJTGGLvs7kAabXSTywMbE7DeO7rbQLB3xXGEyq4MywRicRJA3arNOKMpBWHEoXY4KzyiDqymjmn0QJ66vXAxsssG5TN1mtaLra'
# Actually, key is 256 character-long
msg= s.post(
'http://domain.co.za/opencart/index.php?route=api/login',
data={'username':username, 'key':key}
).text
print(msg)