WordPress Error uploading image: 401 API Python Script

When you’re using Basic Authentication, you can’t just pass the {username}:{password} string; you need to base64-encode it.

libcurl docs on Basic Auth

So your line

'Authorization': 'Basic ' + WP_USER + ':' + WP_APPLICATION_PASSWORD

should be more like

'Authorization': 'Basic ' + base64( WP_USER + ':' + WP_APPLICATION_PASSWORD )

(I don’t know how Python does base64, but it looks like you’re already importing a related library in your Python snippet.)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)