Authenticating python api

I need to get and post data from frappe api using a python script, I am using this link https://2.python-requests.org/en/master/user/authentication/ to authenticate it but it still gives 403 response.

Various logs on the server give key details to help learn and troubleshoot your problem case.

Maybe share pointers of what have you tried?

Try showing us the complete request that you tried. URL, user and password.
Also tell us if you did any customization.

import requests
from requests.auth import HTTPBasicAuth
a = requests.get(‘https://mywebsite.com/api/resource/Attendance’, auth=HTTPBasicAuth(‘Administrator’, ‘mypassword’))
print(a)
I get 401 response
how can I check what is the error or do I need to provide more parameters

Check the logs, they give lots of clues to point the way here 401 Unauthorized - HTTP | MDN

this worked Token Based Authentication

Please note here what you were stuck on or learned, to refer back thanks :slight_smile:

This worked for you too How to pass parameters to rest api methods - #2 by Khadija