Exemple #1
0
import aop
import aop.api
import json


#'电竞APP-ios', 'appkey': '5c76338bb465f50bc6001045'
#'电竞APP', 'appkey': '5c73a5e9f1f55699ab0000ef'


# 设置网关域名
aop.set_default_server('gateway.open.umeng.com')

# 设置apiKey和apiSecurity
aop.set_default_appinfo(1046050, "0HKvp0jGmlp")

# 构造Request和访问协议是否是https
req = aop.api.UmengUappGetAppListRequest()

# 发起Api请求
try:
    resp = req.get_response(None, page=1, perPage=10, accessToken="")
    print(resp)
except aop.ApiError as e:
    # Api网关返回的异常
    print(e)
except aop.AopError as e:
    # 客户端Api网关请求前的异常
    print(e)
except Exception as e:
    # 其它未知异常
    print(e)
Exemple #2
0
                       user=user,
                       password=password,
                       database=database)
cursor1 = conn.cursor()

#### Default settings, begin
"""2. Remote server

Remote server is the server domain or ip. e.g. 'gw.open.1688.com' for 1688.

Set the default server by calling aop.set_default_server(remote_server).
You can also specify the server when newing an API request.
    e.g. req = aop.api.GetServerTimestampRequest(remote_server)

"""
aop.set_default_server('gw.open.1688.com')
"""3. Appkey and secret

Set the default appinfo by calling aop.set_default_appinfo(appkey, secret)
If you need to dynamically bind a different appinfo to the request, call req.set_appinfo(appkey, secret)

"""
aop.set_default_appinfo(appkey, app_secret)  # default
#获取到access token
"""4.Timestamp

Timestamp is milliseconds since midnight, January 1, 1970 UTC and needed by some APIs
due to security concerns.

Timestamp generator is a function taking three arguments: appkey, secret, server domain.