我想使用crusftpftp api设置用户密码。
我正在使用更新用户API https://www..com/crush9wiki/Wiki.jsp?page=API
它与Curl类似
--data-urlencode
> 'user=<?xml+version="1.0"+encoding="UTF-8"?>+<user+type="properties"><password>thisismypass</password></user>'
curl -d command=setUserItem -d data_action=update -d xmlItem=user -d serverGroup=MainUsers -d username=curl_user --data-urlencode 'user=<?xml+version="1.0"+encoding="UTF-8"?>+<user+type="properties"><password>thisismypass</password></user>' http://crushadmin:pass@127.0.0.1:8080/
我尝试转换:
import requests
url = "http://crushadmin:pass@127.0.0.1:8080/"
payload = "command=setUserItem&data_action=update&xmlItem=user&serverGroup=MainUsers&username=curl_user"
headers = {
'cache-control': "no-cache",
'Postman-Token': "9b1c470d-889a-4647-a0f1-4b2a5c00bf68"
}
response = requests.request("GET", url, data=payload, headers=headers)
print(response.text)
但是,我不知道如何输入包含更改密码的xlm
user = + thisismypass
答案 0 :(得分:0)
导入请求
url = 'http://crushadmin:pass@127.0.0.1:8080/'
payload = {
'command': 'setUserItem',
'data_action': 'update',
'xx': 'xx'}
headers = {
'cache-control': 'no-cache',
'Postman-Token': '9b1c470d-889a-4647-a0f1-4b2a5c00bf68'}
response = requests.get(url=url, params=payload, headers=headers)
print(response)