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
47a566ff
Commit
47a566ff
authored
Oct 31, 2024
by
邱阿朋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
cff6b14b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
12 deletions
+27
-12
coop.py
src/coop.py
+1
-0
domain.py
src/helper/domain.py
+22
-0
invoices.py
src/invoices.py
+1
-0
returns.py
src/returns.py
+3
-12
No files found.
src/coop.py
View file @
47a566ff
...
@@ -221,6 +221,7 @@ def main():
...
@@ -221,6 +221,7 @@ def main():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
try
:
try
:
country
=
helper
.
get_input_with_default
(
"国家"
,
"usa"
)
country
=
helper
.
get_input_with_default
(
"国家"
,
"usa"
)
domain
.
domain_page
(
page
,
country
)
main
()
main
()
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
pass
pass
...
...
src/helper/domain.py
View file @
47a566ff
# coding: utf-8
# coding: utf-8
import
time
from
lxml
import
etree
def
switch_domain
(
country
):
def
switch_domain
(
country
):
domain
=
"https://vendorcentral.amazon.com/"
domain
=
"https://vendorcentral.amazon.com/"
...
@@ -15,3 +19,21 @@ def switch_domain(country):
...
@@ -15,3 +19,21 @@ def switch_domain(country):
domain
=
"https://vendorcentral.amazon.com.mx/"
domain
=
"https://vendorcentral.amazon.com.mx/"
return
domain
return
domain
def
domain_page
(
page
,
country
):
url
=
switch_domain
(
country
)
page
.
get
(
url
)
while
True
:
time
.
sleep
(
1
)
title
=
page
.
title
if
title
==
"Amazon Sign-In"
:
print
(
"请登录账号"
)
continue
tree
=
etree
.
HTML
(
page
.
html
)
element
=
tree
.
xpath
(
'//*[@id="cvf-submit-otp-button-announce"]'
)
if
element
:
print
(
'请输入验证码'
)
else
:
break
\ No newline at end of file
src/invoices.py
View file @
47a566ff
...
@@ -329,6 +329,7 @@ def main():
...
@@ -329,6 +329,7 @@ def main():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
try
:
try
:
country
=
helper
.
get_input_with_default
(
"国家"
,
"usa"
)
country
=
helper
.
get_input_with_default
(
"国家"
,
"usa"
)
domain
.
domain_page
(
page
,
country
)
main
()
main
()
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
pass
pass
...
...
src/returns.py
View file @
47a566ff
...
@@ -6,6 +6,7 @@ import time
...
@@ -6,6 +6,7 @@ import time
import
pandas
as
pd
import
pandas
as
pd
from
DrissionPage
import
ChromiumPage
from
DrissionPage
import
ChromiumPage
from
DrissionPage.errors
import
ElementNotFoundError
from
DrissionPage.errors
import
ElementNotFoundError
from
lxml
import
etree
from
helper
import
helper
,
excel
,
file
,
domain
from
helper
import
helper
,
excel
,
file
,
domain
...
@@ -22,23 +23,12 @@ helper.make_dir(download_path)
...
@@ -22,23 +23,12 @@ helper.make_dir(download_path)
# 设置下载路径,确保在打开浏览器前设置
# 设置下载路径,确保在打开浏览器前设置
page
.
set
.
download_path
(
download_path
)
page
.
set
.
download_path
(
download_path
)
def
page_get
(
url
):
def
page_get
(
url
):
host
=
domain
.
switch_domain
(
country
)
host
=
domain
.
switch_domain
(
country
)
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
=
{}
...
@@ -132,6 +122,7 @@ def main():
...
@@ -132,6 +122,7 @@ def main():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
try
:
try
:
country
=
helper
.
get_input_with_default
(
"国家"
,
"usa"
)
country
=
helper
.
get_input_with_default
(
"国家"
,
"usa"
)
domain
.
domain_page
(
page
,
country
)
main
()
main
()
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
pass
pass
...
...
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