Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
665acbf4
authored
2024-09-18 10:21:31 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
init:4944
1 parent
a0d6443d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
src/apps/doc/ocr/ecm.py
src/apps/doc/ocr/ecm.py
View file @
665acbf
...
...
@@ -97,9 +97,13 @@ class ECM(GenericView):
"docbase"
:
self
.
doc_base_map
.
get
(
business_type
),
"documentType"
:
doc_type
,
"objectId"
:
object_id
,
"b_input_date"
:
time
.
strftime
(
"
%
m/
%
d/
%
Y
%
X"
),
"b_credit_signing_date"
:
time
.
strftime
(
"
%
m/
%
d/
%
Y
%
X"
),
"b_id_number"
:
''
,
}
header_info
=
self
.
get_headers
()
self
.
running_log
.
info
(
"{0} download header_info:{1}"
.
format
(
self
.
log_base
,
header_info
))
self
.
running_log
.
info
(
"{0} download args_info:{1}"
.
format
(
self
.
log_base
,
download_json
))
response
=
requests
.
post
(
self
.
download_url
,
headers
=
header_info
,
json
=
download_json
,
verify
=
False
)
if
response
.
status_code
!=
200
:
raise
ECMException
(
'ECM download failed with code: {0}'
.
format
(
response
.
status_code
))
...
...
@@ -137,6 +141,8 @@ class ECM(GenericView):
"b_region"
:
"0"
,
"b_region_name"
:
self
.
b_region_name_map
.
get
(
business_type
),
"b_input_date"
:
time
.
strftime
(
"
%
m/
%
d/
%
Y
%
X"
),
"b_credit_signing_date"
:
time
.
strftime
(
"
%
m/
%
d/
%
Y
%
X"
),
"b_id_number"
:
''
,
# "file_base64_content": "",
}
for
key
in
self
.
upload_fields
:
...
...
@@ -148,9 +154,10 @@ class ECM(GenericView):
args
[
'file_base64_content'
]
=
file_data
header_info
=
self
.
get_headers
()
self
.
running_log
.
info
(
"{0} upload header_info:{1}"
.
format
(
self
.
log_base
,
header_info
))
self
.
running_log
.
info
(
"{0} upload args_info:{1}"
.
format
(
self
.
log_base
,
args
))
response
=
requests
.
post
(
self
.
upload_url
,
headers
=
header_info
,
json
=
args
,
verify
=
False
)
if
response
.
status_code
!=
200
:
raise
ECMException
(
'ECM upload failed with code: {0} , with headers: {1} , with content: {2}'
.
format
(
response
.
status_code
,
response
.
headers
,
response
.
text
))
if
'ns
6
:createResponse'
not
in
response
.
json
()
.
get
(
'S:Envelope'
,
{})
.
get
(
'S:Body'
,
{}):
if
'ns
12
:createResponse'
not
in
response
.
json
()
.
get
(
'S:Envelope'
,
{})
.
get
(
'S:Body'
,
{}):
raise
ECMException
(
'ECM upload failed: {0} , with headers: {1}'
.
format
(
response
.
json
(),
response
.
headers
))
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment