'Issue using the Wordpress REST API with Python

I am currently using the Wordpress API in order to post articles in my test website. As I'm quite new to this, I followed this tutorial : https://medium.com/analytics-vidhya/wordpress-rest-api-with-python-f53a25827b1c (using Application Passwords to access the API)

My issue is that when I write my url as follows in my Python script :

  • url = "https://my-website.com/wp-json/wp/v2/posts" I get <Response [401]> (incorrect password)
  • and when my url is simply "https://my-website.com" I get <Response [200]> (no error but nothing is posted on the website)

It seems like I have an authentication issue when trying to access the Wordpress REST API but I can't find any other issues like this one.

Thank you !

(PS : just precising that my website is hosted on Kinsta, i don't know if it has something to do with it?)



Solution 1:[1]

I had a similar issue recently and found I needed to edit my Bitnami instance's Apache httpd-app.conf config settings by inserting the following line inside the <Directory> tags:

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Source

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rs77