directadmin的官方api有这样一段话
special.php
You must provide ?lid=1234 as GET for each request, no matter what.
Even for POST values, the GET ?lid must always be present. These 'special' commands require that your account has access to these functions.
以下是我写的代码:
import requests
uid = "123456"
password = "123456"
def change_license_ip():
"修改授权ip"
url = "https://www.directadmin.com/clients/api/special.php?lid=12345&saveip=1&ip="
ip = input("请输入新的授权ip:")
r = requests.post(url + ip, auth=(uid, password)) # 用POST方式发送请求并获得响应
print(r.text)
change_license_ip()
但是da的api返回错误。请教一下php里可以通过_get[变量]来传递,python里应该怎么写?谢谢。 |