Closed huangwb8 closed 2 years ago
Successful codes is as follows:
def wp_xmlrpc(domain,username, password):
"""
Error control
"""
try:
client = Client(domain + '/xmlrpc.php', username, password)
print('SUCCESS to connect to your WordPress website: ' + domain)
return client
except Exception as e:
print('FAILED to connect to your WordPress website: ' + str(e))
sys.exit(0)
Here is a common code for request xmlrpc of WordPress:
Sometimes I would meet "TimeOutError". I want to do something when this error appears.
For example:
Where the output of
requests.get
has an attribute calledstatus_code
.Is it possible to manage errors in this way for
Client
function inpython-wordpress-xmlrpc
?