
from param import params
import json
class login:



    def __init__(self,s):
        self.s = s
        self.login = params.login


    def LoginMethod(self,uri):
        '登陆接口'
        url = uri + self.login
        master_uri = "http://earth.iyanzhi.com"
        test_uri = "http://earth.gmapp.env"
        if uri == master_uri:
            master_username = params.master_username
            master_password = params.master_password
            body = {
                "account_type": 2,
                "email": master_username,
                "pwd": master_password
            }
        if uri == test_uri:
            test_username = params.test_username
            test_password = params.test_password
            body = {
                "account_type": 2,
                "email": test_username,
                "pwd": test_password
            }
        result = self.s.post(url=url,data = body, verify=False)
        code = result.status_code
        print("登陆接口：{}".format(code))
        if code == 200:
            res = result.json()
            print(res)
        else:
            print("登陆接口报错")
        return res
