开发者社区> 问答> 正文

流量档位查询API(QueryGrades)---Python如何进行



流量档位查询接口(QueryGrades)



流量充值整体流程及操作步骤


流量充值整体流程及操作步骤

参数说明



入参列表

参数名称参数类型必填与否样例取值参数说明
PhoneNumberString可选13010112022待充值手机号


出参列表

出参名称出参类型样例取值参数说明
RequestIdString8906582E-6722请求ID
CodeStringOK状态码-返回OK代表请求成功,其他错误码详见错误码列表
MessageString请求成功状态码的描述
GradesString{“中国联通”:[“100”],”中国移动”:[“10”,”1024”],”中国电信”:[“10”,”100”]}支持的档位数据JSON格式,单位是M


技术对接步骤



1:下载SDK工具包


SDK工具包中一共包含了2个类库,一个aliyun-java-sdk-core包,另外一个是alicom-dycdp-api包,将这两个包添加到工程依赖中。
SDK&DEMO[ 下载地址]

2: 编写样例程序

  1. [backcolor=transparent]from[backcolor=transparent] aliyunsdkdycdpapi[backcolor=transparent].[backcolor=transparent]request[backcolor=transparent].[backcolor=transparent]v20170525 [backcolor=transparent]import[backcolor=transparent] [backcolor=transparent]ChargeRequest
  2. [backcolor=transparent]from[backcolor=transparent] aliyunsdkdycdpapi[backcolor=transparent].[backcolor=transparent]request[backcolor=transparent].[backcolor=transparent]v20170525 [backcolor=transparent]import[backcolor=transparent] [backcolor=transparent]QueryChargeDetailRequest
  3. [backcolor=transparent]from[backcolor=transparent] aliyunsdkdycdpapi[backcolor=transparent].[backcolor=transparent]request[backcolor=transparent].[backcolor=transparent]v20170525 [backcolor=transparent]import[backcolor=transparent] [backcolor=transparent]QueryGradesRequest
  4. [backcolor=transparent]from[backcolor=transparent] aliyunsdkcore[backcolor=transparent].[backcolor=transparent]client [backcolor=transparent]import[backcolor=transparent] [backcolor=transparent]AcsClient
  5. [backcolor=transparent]"""
  6. [backcolor=transparent]流量档位查询接口API
  7. [backcolor=transparent]Created on 2017-06-12
  8. [backcolor=transparent]"""
  9. [backcolor=transparent]#暂不支持多region,默认配置cn-hangzhou
  10. [backcolor=transparent]REGION [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"cn-hangzhou"
  11. [backcolor=transparent]# ACCESS_KEY_ID/ACCESS_KEY_SECRET 根据实际申请的账号信息进行替换
  12. [backcolor=transparent]ACCESS_KEY_ID [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"yourAccessKeyId"
  13. [backcolor=transparent]ACCESS_KEY_SECRET [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"yourAccessKeySecret"
  14. [backcolor=transparent]#初始化acs_client
  15. [backcolor=transparent]acs_client [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]AcsClient[backcolor=transparent]([backcolor=transparent]ACCESS_KEY_ID[backcolor=transparent],[backcolor=transparent] ACCESS_KEY_SECRET[backcolor=transparent],[backcolor=transparent] REGION[backcolor=transparent])
  16. [backcolor=transparent]def[backcolor=transparent] query_grades[backcolor=transparent]([backcolor=transparent]mobile[backcolor=transparent]):
  17. [backcolor=transparent]    queryGradesRequest [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]QueryGradesRequest[backcolor=transparent].[backcolor=transparent]QueryGradesRequest[backcolor=transparent]()
  18. [backcolor=transparent]    queryGradesRequest[backcolor=transparent].[backcolor=transparent]set_PhoneNumber[backcolor=transparent]([backcolor=transparent]mobile[backcolor=transparent])
  19. [backcolor=transparent]    queryGradesResponse [backcolor=transparent]=[backcolor=transparent] acs_client[backcolor=transparent].[backcolor=transparent]do_action_with_exception[backcolor=transparent]([backcolor=transparent]queryGradesRequest[backcolor=transparent])
  20. [backcolor=transparent]    [backcolor=transparent]return[backcolor=transparent] queryGradesResponse
  21. [backcolor=transparent]print[backcolor=transparent] query_grades[backcolor=transparent]([backcolor=transparent]"15000000000"[backcolor=transparent])

展开
收起
猫饭先生 2017-10-25 13:57:37 1695 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载