使用Python删除模板
使用Python删除模板
Python : API文档
使用Python删除模板
import urllib2
afilnet_class="template"
afilnet_method="deletetemplate"
afilnet_user="user"
afilnet_password="password"
afilnet_idtemplate="1000"
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&idtemplate="+afilnet_idtemplate
result = urllib2.urlopen(sUrl).read()
from urllib.request import urlopen
from urllib.parse import urlencode
afilnet_class="template"
afilnet_method="deletetemplate"
afilnet_user="user"
afilnet_password="password"
afilnet_idtemplate="1000"
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/"
data = urlencode({"class": afilnet_class,"method": afilnet_method,"user": afilnet_user,"password": afilnet_password,"idtemplate": afilnet_idtemplate}).encode("utf-8")
result = urlopen(sUrl, data).read()
print(result)
import requests
afilnet_class="template"
afilnet_method="deletetemplate"
afilnet_user="user"
afilnet_password="password"
afilnet_idtemplate="1000"
# Create an URL request
sUrl = "https://www.afilnet.com/api/basic/?class="+afilnet_class+"&method="+afilnet_method+"&idtemplate="+afilnet_idtemplate
result = requests.get(sUrl,auth=requests.auth.HTTPBasicAuth(afilnet_user,afilnet_password))
print(result.text)
参数 | 描述 | 必修/可选 |
---|---|---|
class=template | 要求的课程:要求的课程 | 必修 |
method=deletetemplate | 请求的类方法:发出请求的类的方法 | 必修 |
user | 您的Afilnet帐户的用户和电子邮件 | 必修 |
password | 您的Afilnet帐户的密码 | 必修 |
idtemplate | 模板标识符 | 必修 |
发出请求时,您将收到以下字段:
- status
-
结果(如果status = success),您将在此处收到以下值:
- 没有其他值会发送给您
- 错误(如果status = error),在这里您将收到错误代码
下面列出了可能的错误代码
码 | 描述 |
---|---|
MISSING_USER | 不包括用户或电子邮件 |
MISSING_PASSWORD | 不包含密码 |
MISSING_CLASS | 不包括课程 |
MISSING_METHOD | 不包括方法 |
MISSING_COMPULSORY_PARAM | 不包括强制参数 |
INCORRECT_USER_PASSWORD | 用户或密码错误 |
INCORRECT_CLASS | 班级不正确 |
INCORRECT_METHOD | 方法不正确 |
NOT_ACCESS_TO_TEMPLATE | 您无权访问所选模板 |
ERROR_ASSIGNED_EVENT | 您无法删除该群组,因为存在与此群组相关联的事件 |
参数:
- class : template
- method : deletetemplate
- user : user
- password : password
- idtemplate : 1000
请求:
https://www.afilnet.com/api/http/?class=template&method=deletetemplate&user=user&password=password&idtemplate=1000