Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
europa-erp-python
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
f7fd1d21
authored
Sep 18, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
handle the file
parent
c1b5117f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
8 deletions
README.md
config.py
rs_data.py
README.md
View file @
f7fd1d21
...
...
@@ -4,12 +4,9 @@ parse the various supplier data.
In order to avoid coupling with other projects, this project is separated
#
Install
dev
#
Run
$ python XXX.py
[
local|dev|prod
]
$ pip3 install -r requirements_dev.txt
xxx.py means different supplier
prod
$ pip3 install -r reuirements_prod.txt
config.py
View file @
f7fd1d21
import
json
def
load_config
()
->
dict
:
def
load_config
_map
()
->
dict
:
with
open
(
'config.json'
,
'r'
,
encoding
=
'UTF-8'
)
as
f
:
return
json
.
load
(
f
)
rs_data.py
View file @
f7fd1d21
import
os.path
import
sys
import
config
from
utils
import
ftp
from
utils
import
file_handle
remote_file_name_1
=
"/rs_components_HK-cn_chiplink.csv.zip"
remote_file_name_2
=
"/rs_components_HK-en_chiplink.csv.zip"
remote_file_name_3
=
"/rs_components_cn_chiplink.csv.zip"
local_file_name_1
=
"rs_components_HK-cn_chiplink.csv.zip"
local_file_name_2
=
"rs_components_HK-en_chiplink.csv.zip"
local_file_name_3
=
"rs_components_cn_chiplink.csv.zip"
conf
=
config
.
load_config_map
()
def
handle_csv
():
pass
if
__name__
==
'__main__'
:
conf
=
config
.
load_config
()
environment
=
sys
.
argv
[
1
]
if
environment
not
in
{
"local"
,
"dev"
,
"prod"
}:
sys
.
exit
(
"param error!"
)
conf_environment
=
conf
[
environment
]
ftp_client
=
ftp
.
FTPUtil
(
host
=
conf_environment
[
"ftp"
][
"host"
],
port
=
conf_environment
[
"ftp"
][
"port"
],
passive
=
True
,
username
=
conf_environment
[
"ftp"
][
"username"
],
password
=
conf_environment
[
"ftp"
][
"password"
]
)
"""download the zip file"""
# ftp_client.download(remote_file_name_1, conf_environment["tmp_file_path"] + local_file_name_1)
# ftp_client.download(remote_file_name_2, conf_environment["tmp_file_path"] + local_file_name_2)
# ftp_client.download(remote_file_name_3, conf_environment["tmp_file_path"] + local_file_name_3)
extract_dir
=
conf_environment
[
"tmp_file_path"
]
+
"extract/"
if
not
os
.
path
.
exists
(
extract_dir
):
os
.
makedirs
(
extract_dir
)
"""unzip the zip file"""
# file_handle.unzip(conf_environment["tmp_file_path"] + local_file_name_1, extract_dir)
# file_handle.unzip(conf_environment["tmp_file_path"] + local_file_name_2, extract_dir)
# file_handle.unzip(conf_environment["tmp_file_path"] + local_file_name_3, extract_dir)
"""handle the file and then post to rabbitmq"""
"""remove the temp file, close the connection"""
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