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

优化

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