Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
inspect_report
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengjinlei
inspect_report
Commits
1a6f7523
Commit
1a6f7523
authored
Mar 24, 2020
by
lvshibao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取req信息
parent
a0cde045
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
tasksapi.py
src/inspect_report/api/tasksapi.py
+1
-0
account.py
src/inspect_report/utils/account.py
+9
-5
No files found.
src/inspect_report/api/tasksapi.py
View file @
1a6f7523
...
@@ -235,6 +235,7 @@ class TasksApi(viewsets.ViewSet):
...
@@ -235,6 +235,7 @@ class TasksApi(viewsets.ViewSet):
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'count'
:
total_count
,
'data'
:
data_sort
})
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'count'
:
total_count
,
'data'
:
data_sort
})
@
action
([
'post'
],
detail
=
False
)
@
action
([
'post'
],
detail
=
False
)
@
get_account_info
def
static
(
self
,
req
:
Request
):
def
static
(
self
,
req
:
Request
):
"""
"""
获取违规项分析
获取违规项分析
...
...
src/inspect_report/utils/account.py
View file @
1a6f7523
import
logging
import
logging
import
requests
import
requests
from
functools
import
wraps
from
rest_framework.request
import
Request
from
rest_framework.request
import
Request
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
def
get_account_info
(
func
):
def
get_account_info
(
func
):
def
wrapper
(
req
:
Request
,
*
args
,
**
kw
):
@
wraps
(
func
)
def
account_info
(
req
:
Request
,
*
args
,
**
kw
):
# info = requests.get('http://172.17.1.74:8248/getUserInfo', headers={
# info = requests.get('http://172.17.1.74:8248/getUserInfo', headers={
# 'Cookie': 'aiforce=a038baa0-9a23-45f6-8042-a01a2309f1a8; JSESSIONID=fef7de70-7157-4b62-abf3-6fe9d2357350; csrfToken=wFVUJX9rT2jyDderTzHKUjaq; EGG_SESS=pRumla5Jc0N4k1qJnqyfP0SIlONA60YZCFEMh2sO_ywQrldAhhiX4Y2exluQfYfm'})
# 'Cookie': 'aiforce=a038baa0-9a23-45f6-8042-a01a2309f1a8; JSESSIONID=fef7de70-7157-4b62-abf3-6fe9d2357350; csrfToken=wFVUJX9rT2jyDderTzHKUjaq; EGG_SESS=pRumla5Jc0N4k1qJnqyfP0SIlONA60YZCFEMh2sO_ywQrldAhhiX4Y2exluQfYfm'})
# print(info.json())
# print(info.json())
...
@@ -14,7 +18,7 @@ def get_account_info(func):
...
@@ -14,7 +18,7 @@ def get_account_info(func):
logger
.
info
(
'req中的query_params为: '
,
req
.
query_params
)
logger
.
info
(
'req中的query_params为: '
,
req
.
query_params
)
logger
.
info
(
'req中的query_params为: '
,
req
.
parsers
())
logger
.
info
(
'req中的query_params为: '
,
req
.
parsers
())
return
func
(
Request
,
*
args
,
**
kw
)
return
func
(
Request
,
*
args
,
**
kw
)
return
wrapper
return
account_info
# get_account_info()
# get_account_info()
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