Post by iamroot$ » Wed May 16, 2018 6:58 pm

Using the example in the official docs, I am trying to access the API

Code: Select all

import requests

s = requests.Session()

username = 'Default'
key = 'tKBmPkpRqeH9i3BbKFNmaRaVLQjT2oyB6Q7q0de9mbmeR7TX69Ccp0cFMMjvH75iJDK6ofjDZBJ5OuaCcYbFQ6gQNCekJifZeTQfilOxaBoI6ue7ICb2EVFgoHHMGi0LW0vLO2SiMsxtkPxQbmXCY7lJ 5KllumPk1UV5C8hOV4NEU1GVvedpdpwQiWgKTwOU13wsCR1ZPJTb9HakOPA8HZs9URoyycE02HKgNc2hzRA0MWnKBIyUdegqeQuLB2Xu'
 
r = s.post('http://myip/index.php?route=api/login', data={'username':username, 'key':key}).text
 print(r)
I get this response

Code: Select all

<b>Notice</b>: Undefined index: api_token in <b>/opt/bitnami/apps/opencart/htdocs/catalog/controller/startup/session.php</b> on line <b>8</b>

Newbie

Posts

Joined
Wed May 16, 2018 6:51 pm

Post by OSWorX » Thu May 17, 2018 5:44 am

And what is your question?

Image


User avatar
Expert Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by iamroot$ » Thu May 17, 2018 1:59 pm

The response that I get is an error. As opposed to the token that I should be receiving from that post request.

Newbie

Posts

Joined
Wed May 16, 2018 6:51 pm

Post by OSWorX » Thu May 17, 2018 3:01 pm

iamroot$ wrote:
Thu May 17, 2018 1:59 pm
The response that I get is an error. As opposed to the token that I should be receiving from that post request.
Correct, the message says all:
<b>Notice</b>: Undefined index: api_token in <b>/opt/bitnami/apps/opencart/htdocs/catalog/controller/startup/session.php</b> on line <b>8</b>
Add this var and it should work

Image


User avatar
Expert Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: DigitCart and 17 guests