Example #1
0
def get_user_profile_api(token):
    url = "https://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get("host") + "/v1/json/user/profile"
    # print(url)
    header = {"Authorization": token}
    response = requests.request("GET", url=url, headers=header)
    print(response.json())
    return response.json()
Example #2
0
def add_antiPhishing_code_api(apCode,GA_code,token):
    url = "https://"+circumstance_config.circumstance_config_init(global_variable.cir_var).get("host")+"/v1/user/antiPhishing/add"
    header = {"Content-Type":"application/json","Authorization":token}
    data = {"apCode":apCode,"gaCode":GA_code}
    response = requests.request("POST",url,headers = header,data = json.dumps(data))
    if response.json().get("status") != "success":
        print("add_antiPhishing_code_api fail,response: ",response.json())
    else:
        print("add_antiPhishing_code_api success!")
    return response.json()
Example #3
0
def bind_GA_send_email_api(token):
    url = "https://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get("host") + "/v1/vcode/bind-ga"
    header = {"Content-Type": "application/json", "Authorization": token}
    response = requests.request("POST", url, headers=header)
    if response.json().get("status") != "success":
        print("bind_GA_send_email_api fail,response: ", response.json())
    else:
        print("bind_GA_send_email_api success!")
    return response.json()
Example #4
0
def get_user_purchase_infos(ieoId, token):
    url = "http://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get(
            "host") + "/v1/ieo/getCurrentUserGroup?projectId=" + repr(ieoId)
    print(url)
    header = {"Content-Type": "application/json", "Authorization": token}
    response = requests.request("GET", url, headers=header)
    if response.json().get("status") != "success":
        print("get user purchase fail! ,response: ", response.json())
    else:
        print("get user purchase success!")
        return response.json()
Example #5
0
def get_GA_secret_api(token):
    url = "https://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get(
            "host") + "/v1/google/user/security/getSecret"
    header = {"Content-Type": "application/json", "Authorization": token}
    response = requests.request("GET", url, headers=header)
    print(response.json())
    if response.json().get("status") != "success":
        print("send GA secret fail,response: ", response.json())
    else:
        print("send GA secret success!")
    return response.json()
Example #6
0
def get_ieo_list(token=None):
    url = "https://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get("host") + "/v1/ieo/queryIeoProjectInfos"
    if token == None:
        response = requests.request("GET", url)
    else:
        header = {"Content-Type": "application/json", "Authorization": token}
        response = requests.request("GET", url, headers=header)

    if response.json().get("status") != "success":
        print("get ieo list fail! ,response: ", response.json())
    else:
        print("get ieo list success!")
        return response.json()
Example #7
0
def get_banner_list(token=None):
    url = "https://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get(
            "host") + "/v1/ui/get_banner_list?type=BANNER&source=IEO"
    if token == None:
        response = requests.request("GET", url)
    else:
        header = {"Content-Type": "application/json", "Authorization": token}
        response = requests.request("GET", url, headers=header)

    if response.json().get("status") != "success":
        print("get banner list fail! ,response: ", response.json())
    else:
        print("get banner list success!")
        return response.json()
Example #8
0
def bind_GA_api(email_code, GA_code, token):
    url = "https://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get(
            "host") + "/v1/google/user/security/bindGA"
    header = {"Content-Type": "application/json", "Authorization": token}
    data = {"vcode": email_code, "code": GA_code}
    response = requests.request("POST",
                                url,
                                headers=header,
                                data=json.dumps(data))
    if response.json().get("status") != "success":
        print("bind_GA_api fail,response: ", response.json())
    else:
        print("bind_GA_api success!")
    return response.json()
Example #9
0
def bind_phone_send_message_api(country, phoneNumber, token):
    url = "https://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get("host") + "/v1/user/phone/sendMessage"
    print(url)
    data = {"phoneNumber": phoneNumber, "country": country}
    header = {"Content-Type": "application/json", "Authorization": token}
    print(header, data)
    response = requests.request("POST",
                                url=url,
                                headers=header,
                                data=json.dumps(data))
    if response.json().get("status") != "success":
        print("bind_phone_send_message_api fail,response: ", response.json())
    else:
        print("bind_phone_send_message_api success!")
    return response.json()
Example #10
0
def get_all_group_list(ieoId, pageSize="20", pageNumber="1", token=None):
    url = "http://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get(
            "host") + "/v1/ieo/getAllGroupList?projectId=" + repr(
                ieoId) + "&pageSize=" + pageSize + "&pageNumber=" + pageNumber
    print(url)
    if token == None:
        response = requests.request("GET", url)
    else:
        header = {"Content-Type": "application/json", "Authorization": token}
        response = requests.request("GET", url, headers=header)

    if response.json().get("status") != "success":
        print("get all group fail! ,response: ", response.json())
    else:
        print("get all group success!")
        return response.json()
Example #11
0
def modify_phone_api(country, emailCode, messageCode, phoneNumber, token):
    url = "https://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get("host") + "/v1/user/phone/modify"
    header = {"Content-Type": "application/json", "Authorization": token}
    data = {
        "country": country,
        "phoneNumber": phoneNumber,
        "messageCode": messageCode,
        "emailCode": emailCode
    }
    print(header, data)
    response = requests.request("POST",
                                url,
                                headers=header,
                                data=json.dumps(data))
    if response.json().get("status") != "success":
        print("modify_phone_api fail,response: ", response.json())
    else:
        print("modify_phone_api success!")
    return response.json()
Example #12
0
def user_ieo_purchase(token, ieoId, paymentCurrency, purchaseAmount, userType,
                      num, groupNumber):
    url = "http://" + circumstance_config.circumstance_config_init(
        global_variable.cir_var).get("host") + "/v1/ieo/userPurchase"
    print(url)
    header = {"Content-Type": "application/json", "Authorization": token}
    data = {
        "ieoCurrencyId": ieoId,
        "paymentCurrency": paymentCurrency,
        "purchaseAmount": purchaseAmount,
        "userType": userType,
        "num": num,
        "groupNumber": groupNumber
    }
    response = requests.request("POST",
                                url,
                                headers=header,
                                data=json.dumps(data))
    print(data)
    if response.json().get("status") != "success":
        print("ieo purchase fail! ,response: ", response.json())
    else:
        print("ieo purchase success!")
        return response.json()
Example #13
0
from config.circumstance_config import circumstance_config_init

from interface.common.login import get_headers, hmac_password
import requests
import json

# Filename: transfer.py
# author: yujie.li

global cir_var
cir_var = "manage-dev1"
global email
email = "*****@*****.**"

config = circumstance_config_init(cir_var)


def login_manage_system(email):
    """登录manage后台管理系统"""
    # config = circumstance_config_init(cir_var)
    password = hmac_password(email, b"password")
    print("password= "******"email": email, "password": password}
    url = "https://" + config.get("host") + "/v1/manage/sign-in"
    print(url)
    response = requests.request("POST",
                                url,
                                headers=headers,
                                data=json.dumps(payload))
    status = response.json()['status']