Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InterfaceAutoTest
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TestAuto
InterfaceAutoTest
Commits
66900d2a
Commit
66900d2a
authored
May 06, 2021
by
taoke
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tk_branch'
parents
a71683aa
c89758d3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
common/db.py
+4
-5
service/login.py
+14
-7
No files found.
common/db.py
View file @
66900d2a
import
redis
,
pymysql
import
redis
,
pymysql
,
enum
# redis类
class
RedisBase
:
...
...
@@ -78,8 +78,8 @@ class MYSQL:
if
__name__
==
'__main__'
:
# r= RedisString(6).get('bmc:captcha:
bf46c0c0-11b4-4b7d-99d7-530f77f8ab88
')
#
r = RedisString(0).get('edl:sms_value:17822000010:MOBILE_REGISTER')
# r= RedisString(6).get('bmc:captcha:
40ec9359-a0e8-42a1-b0c0-c19f199cab60
')
r
=
RedisString
(
0
)
.
get
(
'edl:sms_value:17822000010:MOBILE_REGISTER'
)
# print(r)
# print(str(r)[-7:-1])
pass
\ No newline at end of file
service/login.py
View file @
66900d2a
...
...
@@ -33,7 +33,6 @@ class BMY():
②MD5
③逆序
"""
def
pwd_encrypted
(
self
,
pwd
):
key
=
"Jv+h&c0A"
# 原始密钥
m5dkey
=
Encryption
()
.
get_md5
(
key
)
...
...
@@ -45,20 +44,23 @@ class BMY():
def
get_imageCode
(
self
,
username
,
pwd
):
payload
=
{
"username"
:
username
,
"password"
:
pwd
}
try
:
rep
=
requests
.
get
(
f
"http://testtbdzj.hikcreate.com/web
/website/common/graph/login-captcha"
,
params
=
payload
)
rep
=
requests
.
get
(
"http://testyun.banmago.com/api
/website/common/graph/login-captcha"
,
params
=
payload
)
imageId
=
rep
.
json
()[
'data'
][
'jtId'
]
print
(
"imageID为"
,
imageId
)
result
=
RedisString
(
6
)
.
get
(
f
'bmc:captcha:{imageId}'
)
print
(
result
)
imageCode
=
str
(
result
)[
-
3
:
-
1
]
return
imageId
,
imageCode
except
:
return
(
"imageId"
,
"imageCode"
)
# 返回错误的验证码
def
bmy_login
(
self
,
indata
,
getToken
=
True
):
"""企业云登录"""
# token加密
authorization
=
BMY
()
.
get_authorization
()
header
=
{
"Authorization"
:
authorization
}
payload
=
{
"username"
:
""
,
"password"
:
""
,
"imageId"
:
""
,
"grant_type"
:
"passwordImageCode"
,
"imageCode"
:
""
}
payload
=
{
"username"
:
""
,
"password"
:
""
,
"imageId"
:
""
,
"grant_type"
:
"passwordImageCode"
,
"imageCode"
:
""
}
# 账号
payload
[
'username'
]
=
indata
[
'username'
]
...
...
@@ -70,6 +72,7 @@ class BMY():
imageinfo
=
BMY
()
.
get_imageCode
(
payload
[
'username'
],
payload
[
'password'
])
payload
[
'imageId'
]
=
imageinfo
[
0
]
payload
[
'imageCode'
]
=
imageinfo
[
1
]
print
(
payload
)
resp
=
requests
.
post
(
"http://testyun.banmago.com/api/auth/login"
,
data
=
payload
,
headers
=
header
)
if
getToken
:
...
...
@@ -87,6 +90,11 @@ if __name__ == '__main__':
# headers=getattr(BaseConfig, 'headers'),
# method='post',
# data=None)
indata
=
{
"username"
:
"15150000000"
,
"password"
:
"A123456"
}
token
=
BMY
()
.
bmy_login
(
indata
,
getToken
=
False
)
print
(
token
)
\ No newline at end of file
# indata= {"username":"15150000000","password":"A123456"}
# token= BMY().bmy_login(indata,getToken=False)
# print(token)
# res=BMY().get_imageCode("15150000000","8e4b595babec901009ff84f269ee5147")
# print(res)
BMY
()
.
get_imageCode
(
"15150000000"
,
"8e4b595babec901009ff84f269ee5147"
)
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