Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amazon_reports
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
common
amazon_reports
Commits
dbccc7b8
Commit
dbccc7b8
authored
Oct 26, 2024
by
邱阿朋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
bce53187
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
18 deletions
+44
-18
coop.py
src/coop.py
+20
-8
domain.py
src/helper/domain.py
+0
-0
excel.py
src/helper/excel.py
+0
-0
file.py
src/helper/file.py
+0
-0
helper.py
src/helper/helper.py
+0
-0
invoices.py
src/invoices.py
+12
-5
returns.py
src/returns.py
+12
-5
No files found.
src/coop.py
View file @
dbccc7b8
...
@@ -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'
)
...
...
helper/domain.py
→
src/
helper/domain.py
View file @
dbccc7b8
File moved
helper/excel.py
→
src/
helper/excel.py
View file @
dbccc7b8
File moved
helper/file.py
→
src/
helper/file.py
View file @
dbccc7b8
File moved
helper/helper.py
→
src/
helper/helper.py
View file @
dbccc7b8
File moved
src/invoices.py
View file @
dbccc7b8
...
@@ -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
():
...
...
src/returns.py
View file @
dbccc7b8
# 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
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment