Commit 004fc5ba by zhaihuitao

添加配置地址

parent 8f7f5c5a
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file: mysqlUtil.py
@time: 2020/8/6 14:54
@desc:
"""
import pymysql
class mysqlConn:
def __init__(self, host, user, pwd, db):
self.host = host
self.user = user
self.pwd = pwd
self.db = db
self.__connect()
def __connect(self):
self.__connection = pymysql.connect(self.host, self.user, self.pwd, self.db)
self.__cursor = self.__connection.cursor()
def close(self):
self.__cursor.close()
self.__connection.close()
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file: __init__.py.py
@time: 2020/8/6 15:00
@desc:
"""
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file: mysqlTest.py
@time: 2020/8/6 15:00
@desc:
"""
from common import mysqlUtil
DB_HOST = "localhost"
DB_USER = "root"
DB_PWD = "123456"
DB_NAME = "data"
SQL = "SELECT * FROM DATA"
mysql = mysqlUtil.mysqlConn("localhost", "root", "123456", "data")
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file: analysis.py
@file: yamlUtil.py
@time: 2020/8/4 14:12
@desc: analysis yaml
"""
......
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file: envcfg.py.py
@time: 2020/8/6 17:34
@desc:
"""
# 测试环境:
# 生产环境:
prod = {
"click": {
"url": "http://t.uri6.com/tkio/EFbIzya",
"appkey": "9b17c1568c3ce34599c5fd2778483ff9"
},
"events":{
"url": "http://t.uri6.com/tkio/EFbIzya",
"appkey": "9b17c1568c3ce34599c5fd2778483ff9"
}
}
prod_params = {
# 'androidid': "43214532142142",
'imei': i,
# "idfa": 'DBC13622-E34B-440C-B7A7-FB6641D0D9AB',
'ip': ip,
# "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko)
# Version/5.1 Mobile/9A334 Safari/7534.48.3", 'creativeId':'21321321312123', 'requestId':'312321321312',
# 'adId': long('21231'), 'ry_adgroup_name': ry_adgroup_name, 'ry_adplan_name': ry_adplan_name,
# 'ry_adcreative_name': ry_adcreative_name,
"ry_adgroup_id": ry_adgroup_id,
"ry_adplan_id": ry_adplan_id,
"ry_adcreative_id": ry_adcreative_id,
}
\ No newline at end of file
......@@ -3,14 +3,14 @@ click:
appkey: 9b17c1568c3ce34599c5fd2778483ff9
params:
ry_adcreative_id = '111'
# 广告组ID
ry_adgroup_id = '222'
# 广告计划ID
ry_adplan_id = '333'
# 广告组名称
ry_adgroup_name = '头条广告组2'
# 广告计划名称
ry_adplan_name = '头条广告计划2'
# 广告创意名称
ry_adcreative_name = '头条广告名称2'
\ No newline at end of file
ry_adcreative_id: '111'
# 广告组ID
ry_adgroup_id: '222'
# 广告计划ID
ry_adplan_id: '333'
# 广告组名称
ry_adgroup_name: '头条广告组2'
# 广告计划名称
ry_adplan_name: '头条广告计划2'
# 广告创意名称
ry_adcreative_name: '头条广告名称2'
\ No newline at end of file
......@@ -7,16 +7,11 @@
"""
import os
import random
import requests
import socket
import struct
import yaml
from config.envcfg import prod
import sys
base_path = os.getcwd()
sys.path.append(base_path)
from config.analysis import loadYaml
import config.prod
import time
import requests
# 向短链发送点击数据
# !!!!分包需要删掉https的s
......@@ -64,12 +59,8 @@ for _ in range(1):
#timeout可以超时四秒
# verify = False
# y = config.analysis.loadYaml()
# y.readYaml('/Users/zhaihuitao/gitlab/trackingIO/config/prod/prod.yaml')
# y = yaml.load(open('/Users/zhaihuitao/gitlab/trackingIO/config/prod/prod.yaml', 'r',encoding='utf-8'))
y = loadYaml.read_yaml(loadYaml, '/Users/zhaihuitao/gitlab/trackingIO/config/prod/prod.yaml')
print(y)
p = requests.get(url=y['click']['url'], params=parms, timeout=30, verify= False)
print(prod['click']['url'])
p = requests.get(url=prod['click']['url'], params=parms, timeout=30, verify= False)
print('success:',s)
# print(p.text)
......
......@@ -12,8 +12,10 @@ import requests
import socket
import struct
import yaml
import os
import sys
sys.path.append(r'/Users/zhaihuitao/gitlab/trackingIO/config')
base_path = os.getcwd()
sys.path.append(base_path)
class clickTestCase(unittest.TestCase):
def click(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment