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
7a165b3f
authored
2025-07-30 14:41:03 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add:log
1 parent
203b4a05
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
src/common/mixins.py
src/common/mixins.py
View file @
7a165b3
...
...
@@ -161,13 +161,13 @@ class DocGenericView(LoggerMixin, GenericExceptionMixin, GenericAPIView):
def
get_object
(
self
):
return
None
class
IWABaseView
:
class
IWABaseView
(
LoggerMixin
,
GenericExceptionMixin
,
GenericAPIView
)
:
permission_classes
=
()
authentication_classes
=
()
@staticmethod
def
get_token
(
iwa_url_base
,
code
,
redirect_uri
,
client_id_base64
):
def
get_token
(
self
,
iwa_url_base
,
code
,
redirect_uri
,
client_id_base64
):
headers
=
{
'Authorization'
:
'Basic {0}'
.
format
(
client_id_base64
),
# client_id:secret做base64encode
'Content-type'
:
'application/x-www-form-urlencoded'
,
...
...
@@ -180,6 +180,7 @@ class IWABaseView:
# get_params_str = '&'.join(['{0}={1}'.format(k, v) for k, v in get_params_dict.items()])
iwa_token_url
=
'{0}intranetb2x/access_token'
.
format
(
iwa_url_base
)
res
=
requests
.
post
(
url
=
iwa_token_url
,
headers
=
headers
,
data
=
get_params_dict
)
#self.running_log.info('[iwa url={0}] [res={1}]'.format(iwa_token_url, res))
return
res
.
json
()
.
get
(
'access_token'
,
''
)
...
...
@@ -190,6 +191,7 @@ class IWABaseView:
}
iwa_user_url
=
'{0}intranetb2x/userinfo'
.
format
(
iwa_url_base
)
res
=
requests
.
get
(
iwa_user_url
,
headers
=
headers
)
#self.running_log.info('[iwa url={0}] [res={1}]'.format(iwa_user_url, res))
return
res
.
json
()
.
get
(
'sub'
,
''
)
...
...
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