Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
data_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9867575e
authored
Aug 26, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
modify script
parent
63ec1cee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
handle.py
handle.py
View file @
9867575e
...
@@ -99,21 +99,24 @@ def resolve(file_name: str, supplier_id: int):
...
@@ -99,21 +99,24 @@ def resolve(file_name: str, supplier_id: int):
table
[
"ladder_price"
]
.
append
(
item_map
)
table
[
"ladder_price"
]
.
append
(
item_map
)
ans
=
json
.
dumps
(
table
,
ensure_ascii
=
False
)
ans
=
json
.
dumps
(
table
,
ensure_ascii
=
False
)
producer
.
push
(
ans
)
producer
.
push
(
ans
)
os
.
remove
(
file_name
)
producer
.
close
()
producer
.
close
()
def
process
(
url
:
str
,
supplier_id
:
int
):
def
process
(
url
:
str
,
supplier_id
:
int
):
# http://erp.liexindev.net/sku/20240823/p6jMKaPtjMpNnZMK5vEX3KEQf7Gdvgvw3TCA7d6b.xls
# http://erp.liexindev.net/sku/20240823/p6jMKaPtjMpNnZMK5vEX3KEQf7Gdvgvw3TCA7d6b.xls
abs_path
=
""
try
:
try
:
response
=
requests
.
get
(
url
)
response
=
requests
.
get
(
url
)
if
response
.
status_code
==
200
:
if
response
.
status_code
==
200
:
tmp_file
=
url
.
split
(
sep
=
"/"
)[
-
1
]
tmp_file
=
url
.
split
(
sep
=
"/"
)[
-
1
]
absolute_path
=
config
.
tmp_xls_file_dir
+
tmp_file
absolute_path
=
config
.
tmp_xls_file_dir
+
tmp_file
abs_path
=
absolute_path
with
open
(
absolute_path
,
"wb"
)
as
f
:
with
open
(
absolute_path
,
"wb"
)
as
f
:
f
.
write
(
response
.
content
)
f
.
write
(
response
.
content
)
resolve
(
absolute_path
,
supplier_id
)
resolve
(
absolute_path
,
supplier_id
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
e
)
finally
:
os
.
remove
(
abs_path
)
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