Пример #1
0
 def collection_stock_prices(self, stock_name, filepath=file_path):
     """
     收集股票信息
     :param stock_name:股票代码
     :param filepath:excel文件路径
     :return:
     """
     new_data = {}
     prices = {}
     t = time.strftime("%Y-%m-%d", time.localtime())
     prices['当前'] = self.dr.get_ele_content(stock_new_prices)
     prices['今开'] = self.dr.get_ele_content(stock_opentoday_prices)
     prices['最高'] = self.dr.get_ele_content(stock_highest_prices)
     prices['昨收'] = self.dr.get_ele_content(stock_closeyes_prices)
     prices['最低'] = self.dr.get_ele_content(stock_lowest_prices)
     prices['涨跌幅度'] = self.dr.get_ele_content(stock_increase)
     self.stock_police(stock_name, prices)
     new_data[t] = prices
     excel = operateExcel(filepath, stock_name)
     old_data = excel.get_excel_dict()
     if old_data:
         all_data = {**old_data, **new_data}
     else:
         all_data = new_data
     excel.input_excel(all_data)
     print('采集成功,在{0}中查看'.format(filepath))
     self.dr.get_page_screenshot(case_name=stock_name + '股票_详情')
     BeautifulReport.add_test_img3(stock_name + '股票_详情')
Пример #2
0
 def setUpClass(cls):
     log.info(
         '------------------------  ZClistinter_test  开始 -------------------------------------------------'
     )
     urllib3.disable_warnings()
     login = operateExcel(file_name='zc_interface.xlsx',
                          sheet_name='login').get_excel_list()[0]
     cls.s = requests.session()
     cls.s.post(url=login[1], data=eval(login[3]), verify=False)
     cls.rank = list(
         datetime.datetime.now().isocalendar())  # 获取当前年份、第几周、第几天
     # 通过周数计算期数
     if (datetime.datetime.strptime(
             str(cls.rank[0]) + '-01-01',
             '%Y-%m-%d')).isocalendar()[2] != 1:
         cls.rank[1] = cls.rank[1] - 1
Пример #3
0
import unittest, re
import requests
import urllib3
import ddt
from bs4 import BeautifulSoup
from common.log import Logger
from common.operateExcel import operateExcel

log = Logger('Po.testinterface.ZCtaskinter_test').get_logger()
task = operateExcel(file_name='zc_interface.xlsx',
                    sheet_name='task').get_excel_list()


@ddt.ddt
class ZCtaskinter_test(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        log.info(
            '--------------------------------- ZCtaskinter_test start ---------------------------------------'
        )
        urllib3.disable_warnings()

    @classmethod
    def tearDownClass(cls):
        log.info(
            '--------------------------------- ZCtaskinter_test end ---------------------------------------'
        )

    @ddt.data(*task)
    def test1_cantask_inter(self, data):
        """任务筛选接口"""
Пример #4
0
import unittest
import json
from json import JSONDecodeError
import paramunittest, ddt
from common.base import base
from common.operateExcel import operateExcel
from common.configHttp import Runmain

excel = operateExcel('interface.xlsx', 'Sheet1')
search_data = excel.get_excel()
result_list = []


@ddt.ddt
# @paramunittest.parametrized(*search_data)
class Boos_case(unittest.TestCase):

    # def setParameters(self, case_name, url, method, params, result):
    #     """
    #
    #     :param case_name:
    #     :param url:
    #     :param method:
    #     :param params:
    #     :return:
    #     """
    #     self.case_name = case_name
    #     self.url = url
    #     self.method = method
    #     self.params = eval(params)
    #     self.result = result
Пример #5
0
import unittest, re, os
import requests
import urllib3
import ddt
import openpyxl
from openpyxl.styles import Font, colors
from bs4 import BeautifulSoup
from common.operateExcel import operateExcel
from common.log import Logger
from config.getProjectPath import get_project_path

log = Logger('Po.testinterface.ZCuserinter_test').get_logger()
s = requests.Session()  # 定义一个全局session对象
login = operateExcel(file_name='zc_interface.xlsx',
                     sheet_name='login').get_excel_list()[0]
user = operateExcel(file_name='zc_interface.xlsx',
                    sheet_name='user').get_excel_list()
path = get_project_path()


@ddt.ddt
class ZCuserinter_test(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        log.info(
            '---------------------------- ZCuserinter_test start ---------------------------------------------'
        )
        urllib3.disable_warnings()
        logins = s.post(login[1], data=eval(login[3]), verify=False)
        print(logins.text)
Пример #6
0
import unittest, ddt, requests, urllib3, re, datetime, time, warnings, os
import openpyxl
from openpyxl.styles import colors, Font
from common.operateExcel import operateExcel
from common.log import Logger
from config.getProjectPath import get_project_path

warnings.filterwarnings('ignore')
honor_list = operateExcel(file_name='zc_interface.xlsx',
                          sheet_name='list').get_excel_list()
log = Logger('testinterface.ZClistinter_test').get_logger()
path = get_project_path()


@ddt.ddt
class ZClistinter_test(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        log.info(
            '------------------------  ZClistinter_test  开始 -------------------------------------------------'
        )
        urllib3.disable_warnings()
        login = operateExcel(file_name='zc_interface.xlsx',
                             sheet_name='login').get_excel_list()[0]
        cls.s = requests.session()
        cls.s.post(url=login[1], data=eval(login[3]), verify=False)
        cls.rank = list(
            datetime.datetime.now().isocalendar())  # 获取当前年份、第几周、第几天
        # 通过周数计算期数
        if (datetime.datetime.strptime(
                str(cls.rank[0]) + '-01-01',
Пример #7
0
    #     threads.append(threadx)
    #     # threadx.start()
    #     # threadx.join()  #主线程等待thread(x)线程结束才继续执行
    # # 启动所有线程
    # for threadwt in threads:
    #     threadwt.start()
    # # 主线程中等待所有子线程退出
    # for threadon in threads:
    #     threadon.join()
    # print("退出主线程。。。")



    # 多个用户并发
    threads = []
    movingdatas = operateExcel().read_07_Excel("../datas/BUphone.xlsx", "Sheet1")  # 获取Excel中的BUtoken
    service = "/app/v1/generalTran"   # 接口名称
    dfthreadID = 1
    event_obj = threading.Event()  # 定义flag线程等待,默认为false
    for i in range(0,5):
        for movingdata in movingdatas:
            # 动态获取用户参数
            datatmp = {"fromUserMobile":str(movingdata),
                       "toUserMobile":"18716200017",
                       "randomNum":"test_randomNum" + str(movingdata) + str(random.randint(1000,9999)),
                       "tranBody":"抽奖",
                       "outTradeNo":"test_outTradeNo_auto" + str(movingdata) + str(random.randint(1000,9999)) + str(random.randint(1000,9999)),
                       "createIp":"192.168.1.31",
                       "buAmount":"10",
                       # "attachStr":"teststr_001",  # 非必传
                       #  "notifyUrl":"192.168.1.31",  # 非必传
Пример #8
0
import json
import time
import multiprocessing as mp
import unittest, ddt, requests, urllib3, re, datetime, os
from common.operateExcel import operateExcel
from common.log import Logger
from common import SMS
from config.getProjectPath import get_project_path

fill_name = 'stock_interface.xlsx'
sheet_name = 'stock'
stock = operateExcel(file_name=fill_name,
                     sheet_name=sheet_name).get_excel_list()
log = Logger('testinterface.Stockinter_test').get_logger()
path = get_project_path()
file_path = os.path.join(path, 'file', 'stock.xlsx')


class Stockinter_test(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        log.info(
            '------------------------ Stockinter_test 开始 -------------------------------------------------'
        )
        urllib3.disable_warnings()

    @classmethod
    def tearDownClass(cls):
        log.info(
            '------------------------ Stockinter_test 结束 -------------------------------------------------'
        )
Пример #9
0
        self.processID = processID
        self.name = name
        self.service = service
        self.data = data
        self.signal = signal

    # 重写Process的run()
    def run(self):
        self.signal.wait()
        r = request2buApi(self.service, self.data).send()
        print([r[4], r[0], r[1], r[3], r[2]])


if __name__ == "__main__":
    processes = []
    butokens = operateExcel().read_07_Excel("../datas/BUtoken.xlsx", "Sheet1")
    service = "/wallet/v1/myAssert"  # 接口名称
    dfprocessID = 1
    event_signal = multiprocessing.Event()
    for i in range(1, 2):
        for butoken in butokens:
            datatmp = {"token": butoken}  # 动态获取用户token参数
            processx = "process" + str(dfprocessID)
            processname = "process-" + str(dfprocessID)
            processx = tomultiprocess(dfprocessID, processname, service,
                                      datatmp, event_signal)
            processes.append(processx)
            dfprocessID += 1
    for processwt in processes:
        processwt.start()
    event_signal.set()
Пример #10
0
# coding:utf-8
# @author : csl
# @date   : 2018/07/04 15:01
# 获取olo钱包注册用户

import requests
import json
from common.operateExcel import operateExcel

requrl = "http://192.168.8.163:8000/v1/genkey"
datapath = "D://keysAPI.xlsx"
resultdatas = []
for i in range(0,1200):
    reqresult = requests.get(requrl)
    # reqdata = eval(reqresult.text)
    reqdata = json.loads(reqresult.text)
    # print(type(reqdata))
    reqdatas = [reqdata["result"]["privkey"], reqdata["result"]["address"]]
    resultdatas.append(reqdatas)
print("开始保存数据")
operateExcel().write_07_Excel(datapath, resultdatas)
# print(resultdatas)
print("保存成功")