prestest 0.0.1
prestest Tool.
License: MIT
Requires Python: >=3.6.0


prestest
=======================
测试中
```python
class Tool(object):
    def __init__(self):
        fakerData = Faker('zh_CN')
        self.fakerData = fakerData  # 随机假数据
        self.dingTalkToken = ''
        self.dingTalkSignKey = ''
        self.qyWechatToken = ''
        self.mailFromUser = ''
        self.mailFromUserPwd = ''
        self.mailFromUserHost = ''

    @staticmethod
    def logger(msg):
        loggerUtil(msg)

    @staticmethod
    def getCookies(url, data, method='GET'):
        return getCookiesUtil(url, data, method)

    @staticmethod
    def urlEncode(url):
        return stringCodingUtil(url, 'url_encode')

    @staticmethod
    def urlDecode(url):
        return stringCodingUtil(url, 'url_decode')

    @staticmethod
    def base64Encode(preStr):
        return stringCodingUtil(preStr, 'base64_encode')

    # 解析json
    @staticmethod
    def jsonLoads(jsonStr):
        return jsonUtil(jsonStr, 'jsonLoad')

    # 转成json
    @staticmethod
    def jsonDumps(dictStr):
        return jsonUtil(dictStr, 'jsonDump')

    @staticmethod
    def transDataToUrl(url, data):
        return transDataToUrlUtil(url, data)

    @staticmethod
    def timeStamp(timeStamp='s'):
        return timeStampUtil(timeStamp)

    @staticmethod
    def getNowTime(dataType='-'):
        return getNowTimeUtil(dataType)

    @staticmethod
    def toSha256(preStr):
        return toEncryptUtil(preStr, 'sha256')

    @staticmethod
    def toMD5(preStr):
        return toEncryptUtil(preStr, 'md5')

    @staticmethod
    def toHmac256(preStr, signKey):
        return toEncryptUtil(preStr, 'hmac256', signKey)

    # 随机UA信息
    def randomUA(self, bType=''):
        if bType == 'chrome':
            return self.fakerData.chrome()
        elif bType == 'firefox':
            return self.fakerData.firefox()
        elif bType == 'ie':
            return self.fakerData.internet_explorer()
        elif bType == 'opera':
            return self.fakerData.opera()
        elif bType == 'safari':
            return self.fakerData.safari()
        else:
            return self.fakerData.user_agent()

    def randomNumber(self, n):
        ran = str(self.fakerData.random_number(n))
        lth = len(ran)
        return ran if lth == n else '0' * (n - lth) + ran

    def randomPhone(self):
        return str(self.fakerData.phone_number())

    def randomSsn(self):
        return str(self.fakerData.ssn())

    def randomName(self):
        return self.fakerData.name()

    def randomString(self, n):
        return randomStringUtil(n)

    @staticmethod
    def httpClient(url, data, method, cookies={}, headers={}):
        return httpClientUtil(url, data, method, cookies, headers)

    @staticmethod
    def getIpByUrl(url):
        return getIpByUrlUtil(url)

    def sendDingTalkMsg(self, msg):
        sendRobotMsgUtil(msg, 'dingTalk', dingTalkSignKey=self.dingTalkSignKey, dingTalkToken=self.dingTalkToken)

    def sendQyWechatMsg(self, msg):
        sendRobotMsgUtil(msg, 'qyWechat', qyWechatToken=self.qyWechatToken)

    def sendMailMsg(self, msg, toUser, title, content):
        sendMailUtil(self.mailFromUser, self.mailFromUserPwd, self.mailFromUserHost, toUser, title, content)

    def xmlToDict(self, pXml):
        return xmltoDictUtil(pXml)




```