import json

import requests
from Ansjer.config import SERVER_TYPE

base_url = ''
if SERVER_TYPE == "Ansjer.us_config.test_settings":
    base_url = 'http://test.dvema.com/'
elif SERVER_TYPE == "Ansjer.cn_config.test_settings":
    base_url = 'http://http://test.zositechc.cn/'

username='13800138001'
password='ansjer999999'
login_url = base_url + 'account/login'

data = {
    'userName': username,
    'userPwd': password
}
res = requests.post(url=login_url, data=data)
res = res.json()
print(res)

if res['result_code'] == 0:
    statistics_url = base_url + 'statistcs/pushMonth'
    data = {
        'token': res['result']['access_token']
    }
    res = requests.post(url=statistics_url, data=data)
    print(res.json())

