使用Python修改子帐户
使用Python修改子帐户
Python : API文档
使用Python修改子帐户
import urllib2
afilnet_class="subaccount"
afilnet_method="modifysubaccount"
afilnet_user="user"
afilnet_password="password"
afilnet_accountemail="email@email.com"
afilnet_modifypassword="1"
afilnet_accountpassword="password"
afilnet_namelastname="name+lastname"
afilnet_iscompany="1"
afilnet_companyname="mycompany"
afilnet_documentid="123456789A"
afilnet_language="en"
afilnet_countrycode="us"
afilnet_cityid="1"
afilnet_cityname="town"
afilnet_zipcode="123456"
afilnet_address="address"
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&accountemail="+afilnet_accountemail+"&modifypassword="+afilnet_modifypassword+"&accountpassword="+afilnet_accountpassword+"&namelastname="+afilnet_namelastname+"&iscompany="+afilnet_iscompany+"&companyname="+afilnet_companyname+"&documentid="+afilnet_documentid+"&language="+afilnet_language+"&countrycode="+afilnet_countrycode+"&cityid="+afilnet_cityid+"&cityname="+afilnet_cityname+"&zipcode="+afilnet_zipcode+"&address="+afilnet_address
result = urllib2.urlopen(sUrl).read()
from urllib.request import urlopen
from urllib.parse import urlencode
afilnet_class="subaccount"
afilnet_method="modifysubaccount"
afilnet_user="user"
afilnet_password="password"
afilnet_accountemail="email@email.com"
afilnet_modifypassword="1"
afilnet_accountpassword="password"
afilnet_namelastname="name+lastname"
afilnet_iscompany="1"
afilnet_companyname="mycompany"
afilnet_documentid="123456789A"
afilnet_language="en"
afilnet_countrycode="us"
afilnet_cityid="1"
afilnet_cityname="town"
afilnet_zipcode="123456"
afilnet_address="address"
# 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,"accountemail": afilnet_accountemail,"modifypassword": afilnet_modifypassword,"accountpassword": afilnet_accountpassword,"namelastname": afilnet_namelastname,"iscompany": afilnet_iscompany,"companyname": afilnet_companyname,"documentid": afilnet_documentid,"language": afilnet_language,"countrycode": afilnet_countrycode,"cityid": afilnet_cityid,"cityname": afilnet_cityname,"zipcode": afilnet_zipcode,"address": afilnet_address}).encode("utf-8")
result = urlopen(sUrl, data).read()
print(result)
import requests
afilnet_class="subaccount"
afilnet_method="modifysubaccount"
afilnet_user="user"
afilnet_password="password"
afilnet_accountemail="email@email.com"
afilnet_modifypassword="1"
afilnet_accountpassword="password"
afilnet_namelastname="name+lastname"
afilnet_iscompany="1"
afilnet_companyname="mycompany"
afilnet_documentid="123456789A"
afilnet_language="en"
afilnet_countrycode="us"
afilnet_cityid="1"
afilnet_cityname="town"
afilnet_zipcode="123456"
afilnet_address="address"
# Create an URL request
sUrl = "https://www.afilnet.com/api/basic/?class="+afilnet_class+"&method="+afilnet_method+"&accountemail="+afilnet_accountemail+"&modifypassword="+afilnet_modifypassword+"&accountpassword="+afilnet_accountpassword+"&namelastname="+afilnet_namelastname+"&iscompany="+afilnet_iscompany+"&companyname="+afilnet_companyname+"&documentid="+afilnet_documentid+"&language="+afilnet_language+"&countrycode="+afilnet_countrycode+"&cityid="+afilnet_cityid+"&cityname="+afilnet_cityname+"&zipcode="+afilnet_zipcode+"&address="+afilnet_address
result = requests.get(sUrl,auth=requests.auth.HTTPBasicAuth(afilnet_user,afilnet_password))
print(result.text)
参数 | 描述 | 必修/可选 |
---|---|---|
class=subaccount | 要求的课程:要求的课程 | 必修 |
method=modifysubaccount | 请求的类方法:发出请求的类的方法 | 必修 |
user | 您的Afilnet帐户的用户和电子邮件 | 必修 |
password | 您的Afilnet帐户的密码 | 必修 |
accountemail | 帐户的电子邮件 | 必修 |
modifypassword | 必修 | |
accountpassword | 户口密码 | 可选的 |
namelastname | 联系人姓名 | 必修 |
iscompany | (0)如果是自然人,或者(1)如果是公司 | 必修 |
companyname | 公司名称(如果是公司) | 可选的 |
documentid | 公司识别文件代码 | 必修 |
language | 子帐户的语言。见附表 | 必修 |
countrycode | ISO国家/地区代码,采用ISO-3166-1 ALPHA-2格式 | 必修 |
cityid | 城市识别码 | 必修 |
cityname | 所属城市名称 | 必修 |
zipcode | 邮政编码 | 必修 |
address | 实际地址 | 必修 |
发出请求时,您将收到以下字段:
- status
-
结果(如果status = success),您将在此处收到以下值:
- 没有其他值会发送给您
- 错误(如果status = error),在这里您将收到错误代码
下面列出了可能的错误代码
码 | 描述 |
---|---|
MISSING_USER | 不包括用户或电子邮件 |
MISSING_PASSWORD | 不包含密码 |
MISSING_CLASS | 不包括课程 |
MISSING_METHOD | 不包括方法 |
MISSING_COMPULSORY_PARAM | 不包括强制参数 |
INCORRECT_USER_PASSWORD | 用户或密码错误 |
INCORRECT_CLASS | 班级不正确 |
INCORRECT_METHOD | 方法不正确 |
EMPTY_COUNTRYCODE | 国家区号为空 |
EMPTY_FIELDS | 一些必填字段为空 |
COUNTRY_NOT_FOUND | 没有指定密码的国家/地区 |
EMPTY_CITY | 您尚未指示城市 |
CITY_NOT_FOUND | 显示的城市不存在 |
INCORRECT_EMAIL | 包含的电子邮件无效 |
INCORRECT_PASSWORD | 包含的密码无效 |
ACCOUNT_NOT_FOUND | 找不到用户帐户 |
参数:
- class : subaccount
- method : modifysubaccount
- user : user
- password : password
- accountemail : email@email.com
- modifypassword : 1
- accountpassword : password
- namelastname : name+lastname
- iscompany : 1
- companyname : mycompany
- documentid : 123456789A
- language : en
- countrycode : us
- cityid : 1
- cityname : town
- zipcode : 123456
- address : address
请求:
https://www.afilnet.com/api/http/?class=subaccount&method=modifysubaccount&user=user&password=password&accountemail=email@email.com&modifypassword=1&accountpassword=password&namelastname=name+lastname&iscompany=1&companyname=mycompany&documentid=123456789A&language=en&countrycode=us&cityid=1&cityname=town&zipcode=123456&address=address