Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
AutoApiTest
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
business
AutoApiTest
Commits
345e5e37
Commit
345e5e37
authored
Jan 12, 2021
by
liangfenglong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
7f0f13f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
settings.py
conf/settings.py
+1
-1
gmhttp.py
utils/gmhttp.py
+6
-4
No files found.
conf/settings.py
View file @
345e5e37
...
@@ -5,7 +5,7 @@ LIVE_USER = {
...
@@ -5,7 +5,7 @@ LIVE_USER = {
'password'
:
'a123456'
'password'
:
'a123456'
}
}
LIVE_WATCHER
=
{
LIVE_WATCHER
=
{
'phone'
:
'1
3608913121
'
,
'phone'
:
'1
8855556666
'
,
'password'
:
'a123456'
'password'
:
'a123456'
}
}
HERA_SESSION
=
'tm115sjlt2nzimgxfa34c91xghvor1ue'
HERA_SESSION
=
'tm115sjlt2nzimgxfa34c91xghvor1ue'
...
...
utils/gmhttp.py
View file @
345e5e37
...
@@ -19,7 +19,7 @@ class LoginFailedException(Exception):
...
@@ -19,7 +19,7 @@ class LoginFailedException(Exception):
# 支持更换用户
# 支持更换用户
def
require_login
(
arg
=
None
,
**
user_dict
):
def
require_login
(
user_dict
):
'''
'''
依然使用requests,只不过在使用过程中被替换成了gmhttp
依然使用requests,只不过在使用过程中被替换成了gmhttp
:param func:
:param func:
...
@@ -31,7 +31,7 @@ def require_login(arg=None, **user_dict):
...
@@ -31,7 +31,7 @@ def require_login(arg=None, **user_dict):
def
_inner
(
*
args
,
**
kwargs
):
def
_inner
(
*
args
,
**
kwargs
):
# 哈哈,不知道写啥
# 哈哈,不知道写啥
try
:
try
:
newhttp
=
_Gmhttp
.
instance
(
**
user_dict
)
newhttp
=
_Gmhttp
.
instance
(
**
user_dict
_n
)
except
LoginFailedException
:
except
LoginFailedException
:
# 登录失败后,使用无登录状态尝试访问
# 登录失败后,使用无登录状态尝试访问
return
func
(
*
args
,
**
kwargs
)
return
func
(
*
args
,
**
kwargs
)
...
@@ -52,8 +52,10 @@ def require_login(arg=None, **user_dict):
...
@@ -52,8 +52,10 @@ def require_login(arg=None, **user_dict):
return
_inner
return
_inner
# 为了兼容@require_login 直接使用
# 为了兼容@require_login 直接使用
if
callable
(
arg
):
if
callable
(
user_dict
):
return
outer
(
arg
)
user_dict_n
=
{}
return
outer
(
user_dict
)
user_dict_n
=
user_dict
return
outer
return
outer
...
...
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