-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Extract wp_xmlrpc as an internal function of m2w module + Update upload.py
- Loading branch information
Showing
3 changed files
with
26 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
import sys | ||
from wordpress_xmlrpc import Client | ||
|
||
def wp_xmlrpc(domain,username, password): | ||
""" | ||
错误控制相关的Client函数 | ||
:param domain: 网站域名 | ||
:param username: 帐号 | ||
:param password: 该帐号的密码 | ||
""" | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters