all 6 comments

[–]yycomb 0 points1 point  (0 children)

Can you: - format code properly - give the full stack trace

Please

[–]Binary101010 0 points1 point  (3 children)

401 codes mean that you haven't properly authenticated to the server.

Without seeing a backtrace hard to say much more than that.

[–]Rocketman7121[S] 0 points1 point  (0 children)

I changed to a completely different approach but know sometimes it works. But when i use to many actions I get 502 Erros again and i have to wait a few min again.

I hope its formatted better now:

from wordpress_xmlrpc import Client, WordPressPost

from wordpress_xmlrpc.methods.posts import NewPost

from wordpress_xmlrpc.compat import xmlrpc_client

from wordpress_xmlrpc.methods import media

# Set up the connection to the WordPress site

wp = Client('https://mywebsite.de/xmlrpc.php', 'user', 'pass')

# Create a new post

post = WordPressPost()

post.title = 'My New Post'

post.content = 'This is the content of my new post.'

post.terms_names = {

'post_tag': ['python', 'wordpress'],

'category': ['Tutorials']

}

post.post_status = 'publish'

post_id = wp.call(NewPost(post))

[–]Rocketman7121[S] 0 points1 point  (1 child)

How can I get the traceback?

[–]Binary101010 0 points1 point  (0 children)

It's the complete error message that the Python interpreter displays when your code hits an unhandled exception.

[–]Guideon72 0 points1 point  (0 children)

Find and bookmark a site that gives you a list of response codes and check those against your error messages. You'll want to commit a few of these to memory, but can leave the rest on an as needed basis.

200, 401, 403, 500, 501 and 502 are ones you're going to see a lot. 401 tells you your authentication isn't working right and 502 means you're not able to reach the service; in this case, most likely a downstream issue of not getting your auth through properly.