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
8ef9d025
authored
2021-11-04 11:13:15 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
f83bf474
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
src/apps/doc/ocr/ecm.py
src/apps/doc/views.py
src/apps/doc/ocr/ecm.py
View file @
8ef9d02
...
...
@@ -150,7 +150,7 @@ class ECM:
args
[
'file_base64_content'
]
=
file_data
response
=
requests
.
post
(
self
.
upload_url
,
headers
=
self
.
get_headers
(),
json
=
args
,
verify
=
False
)
if
response
.
status_code
!=
200
:
raise
ECMException
(
'ECM upload failed with code: {0} , with headers: {1}'
.
format
(
response
.
status_code
,
response
.
headers
))
raise
ECMException
(
'ECM upload failed with code: {0} , with headers: {1}
, with content: {2}
'
.
format
(
response
.
status_code
,
response
.
headers
,
response
.
text
))
if
'ns6: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
))
...
...
src/apps/doc/views.py
View file @
8ef9d02
...
...
@@ -846,7 +846,8 @@ class DocView(GenericView, DocHandler):
if
not
pdf_file
.
name
.
endswith
(
'pdf'
)
and
not
pdf_file
.
name
.
endswith
(
'PDF'
):
self
.
invalid_params
(
msg
=
'invalid params: not a PDF file'
)
business_type
=
random
.
choice
(
consts
.
BUSINESS_TYPE_LIST
)
# business_type = random.choice(consts.BUSINESS_TYPE_LIST)
business_type
=
consts
.
BUSINESS_TYPE_LIST
[
0
]
tmp_save_path
=
os
.
path
.
join
(
conf
.
DATA_DIR
,
business_type
,
'{0}.pdf'
.
format
(
metadata_version_id
))
file_write
(
pdf_file
,
tmp_save_path
)
...
...
@@ -865,7 +866,8 @@ class DocView(GenericView, DocHandler):
# 1. 上传信息记录
application_id
=
'{0}{1}'
.
format
(
consts
.
FIXED_APPLICATION_ID_PREFIX
,
metadata_version_id
)
upload_finish_time
=
timezone
.
now
()
document_scheme
=
random
.
choice
(
consts
.
DOC_SCHEME_LIST
)
# document_scheme = random.choice(consts.DOC_SCHEME_LIST)
document_scheme
=
consts
.
DOC_SCHEME_LIST
[
1
]
data_source
=
random
.
choice
(
consts
.
DATA_SOURCE_LIST
)
# UploadDocRecords.objects.create(
# metadata_version_id=metadata_version_id,
...
...
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