bharat
1
Hello Community Members,
I am trying to access ERPNext through rest api using requests module of python, using below code:
import requests
r = requests.get(‘http://myurl/login’, data = {‘usr’:‘administrator’, ‘pwd’:‘ab@134’})
print “============”, r.json, r.url
I am not able to login into the system, am I doing something wrong ? Please guide if some one has experience in this same area.
I am looking to fetch information from ERPNext through rest api and would like to get response in JSON format.
hi bharat, think you should login first using post request then you can use get to retrive data.
reading from https://frappe.github.io/frappe/user/en/guides/integration/rest_api
bharat
3
r = requests.post(‘http://myurl/api/method/login’, data = {‘usr’:‘administrator’, ‘pwd’:‘134’})
gave response 200, which is OK according to HTTP status.
a = requests.get(‘http://myurl/api/method/frappe.auth.get_logged_user’)
gives 403, which is Forbidden according to HTTP status.
Am i missing something ? Due to this I think i cannot read through records. Any help is much appreciated.
bharat
6
Hi max,
Thanks for the pointer. Any example will be more helpful which uses frappe-client, would you please let me know if possible ?
nikzz
9
I’m stucked at same isse, ie login status=200 but for confirmation, 403 error.
Any suggestions ?