Skip to content
Upload media on wordpress by using python. Media can have custom fields like description and caption. Project uses the new REST Api on Wordpress
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
generate_token_with_wpplugin.jpg
upload_image_to_wp.py
wp_plugin_used.jpg

README.md

wp_upload_media

Upload media on wordpress by using python. Media can have custom fields like description and caption. Project uses the new REST Api on Wordpress

Python Version

for Python version 3.6

Plugin used for generation of tokens in Wordpress

https://wordpress.org/plugins/application-passwords/

Fix for Wordpress plugin in case it's not working:

citing from: https://discussion.dreamhost.com/t/how-to-post-content-to-wordpress-using-python-and-rest-api/65166

"For a quick demo, the Application Passwords plugin for WordPress21 is the easiest choice. The installation is straightforward, and the instructions to generate a password for the client application are quite simple to follow. I needed to modify the .htaccess file9 due to the way my DreamPress site is configured. Notice: the password generated by the plugin contains white spaces, and they are part of the password. Once the WordPress authentication is taken care of, it’s all much easier."

Fix:

https://github.com/georgestephanis/application-passwords/wiki/Basic-Authorization-Header----Missing

change .htaccess

citing from above you have to do the following:

"What we need to do is add this line:

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

directly after the RewriteEngine On line -- so your final block will look like this:"

You can’t perform that action at this time.