Commit dbccc7b8 authored by 邱阿朋's avatar 邱阿朋

优化

parent bce53187
......@@ -3,6 +3,7 @@
import math
import os
import shutil
import time
from urllib.parse import urlparse, parse_qs
import pandas as pd
......@@ -31,6 +32,17 @@ def page_get(url):
full_url = host + url
page.get(full_url, timeout=3)
while True:
time.sleep(1)
title = page.title
if title == "Amazon Sign-In":
print("请登录账号")
continue
try:
page.ele("#cvf-submit-otp-button-announce")
print("请输入验证码")
except ElementNotFoundError:
break
def sku_relations():
relations_dict = {}
......@@ -45,14 +57,14 @@ def sku_relations():
def export_list_read_data():
file_name = "ContraCogsInvoices.xls"
if not os.path.isfile(file_name):
raise FileNotFoundError(f"{file_name},文件不存在")
# page_get("hz/vendor/members/coop?ref_=vc_xx_subNav")
# # 全选
# page.ele("#select-all").click()
# # 点击选项卡
# page.ele("#cc-invoice-actions-dropdown").click()
# # 点击下载报表
# page.ele("#cc-invoice-actions-dropdown_2").click.to_download().wait()
# raise FileNotFoundError(f"{file_name},文件不存在")
page_get("hz/vendor/members/coop?ref_=vc_xx_subNav")
# 全选
page.ele("#select-all").click()
# 点击选项卡
page.ele("#cc-invoice-actions-dropdown").click()
# 点击下载报表
page.ele("#cc-invoice-actions-dropdown_2").click.to_download().wait()
return pd.read_excel(file_name, engine='xlrd')
......
......@@ -2,6 +2,7 @@
# 回款明细
import os
import re
import time
import urllib.parse
import warnings
......@@ -27,11 +28,17 @@ page.set.download_path(download_path)
# 忽略 openpyxl 样式警告
warnings.filterwarnings("ignore", category=UserWarning, module="openpyxl")
def page_get(url):
host = domain.switch_domain(country)
full_url = host + url
page.get(full_url, timeout=3)
while True:
time.sleep(1)
title = page.title
if title == "Amazon Sign-In":
print("请登录账号")
continue
try:
page.ele("#cvf-submit-otp-button-announce")
print("请输入验证码")
except ElementNotFoundError:
break
def export_list_read_data():
......
# coding: utf-8
# 导出退款记录
import os
import time
import pandas as pd
from DrissionPage import ChromiumPage
......@@ -21,11 +22,17 @@ helper.make_dir(download_path)
# 设置下载路径,确保在打开浏览器前设置
page.set.download_path(download_path)
def page_get(url):
host = domain.switch_domain(country)
full_url = host + url
page.get(full_url, timeout=3)
while True:
time.sleep(1)
title = page.title
if title == "Amazon Sign-In":
print("请登录账号")
continue
try:
page.ele("#cvf-submit-otp-button-announce")
print("请输入验证码")
except ElementNotFoundError:
break
def sku_relations():
......
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