Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
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
钟尚武
physical
Commits
fdcf5e31
Commit
fdcf5e31
authored
Aug 10, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ad
parent
81ffe9b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
11 deletions
+7
-11
auto_request.py
vest/request/auto_request.py
+5
-1
auto_user_id.py
vest/request/auto_user_id.py
+0
-3
get_session.py
vest/request/get_session.py
+2
-7
No files found.
vest/request/auto_request.py
View file @
fdcf5e31
...
...
@@ -104,7 +104,11 @@ def get_cookies(user_id):
try
:
session_key
=
"majia_login_session"
data
=
redis_client
.
hget
(
session_key
,
user_id
)
return
data
logging
.
info
(
"get data:
%
s"
%
data
)
logging
.
info
(
"get data:
%
s"
%
json
.
loads
(
data
))
return
json
.
loads
(
data
)
except
:
return
None
...
...
vest/request/auto_user_id.py
View file @
fdcf5e31
...
...
@@ -22,10 +22,7 @@ def get_data():
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
if
len
(
user_id
):
print
(
user_id
)
user_id_list
.
append
(
user_id
[
0
])
else
:
pass
pc
.
close
()
return
user_id_list
except
:
...
...
vest/request/get_session.py
View file @
fdcf5e31
import
requests
import
traceback
import
logging
import
json
from
libs.cache
import
redis_client
login_url
=
"http://earth.iyanzhi.com/api/account/login_pwd"
...
...
@@ -11,9 +12,7 @@ def index_first():
r1
=
requests
.
get
(
login_url
)
return
r1
.
cookies
.
get_dict
()
except
:
logging
.
error
(
"index_first:
%
s"
%
traceback
.
format_exc
())
return
None
...
...
@@ -22,10 +21,8 @@ def get_cook():
data
=
open
(
"/srv/apps/physical/vest/data/vest_user_email.txt"
)
list
=
[]
dicts
=
{}
for
i
in
data
:
list
.
append
(
i
.
strip
(
'
\n
'
)
.
strip
(
','
))
for
i
in
list
:
cookies
=
index_first
()
post_dict
=
{
...
...
@@ -44,9 +41,7 @@ def get_cook():
cook
=
cook
[
0
]
.
split
(
'='
)[
1
]
logging
.
info
(
"response.text :
%
s"
%
response
.
text
)
dicts
[
i
]
=
cook
return
dicts
except
:
logging
.
error
(
"index_first:
%
s"
%
traceback
.
format_exc
())
...
...
@@ -59,7 +54,7 @@ def get_session():
session_key
=
"majia_login_session"
dicts
=
get_cook
()
for
key
,
value
in
dicts
.
items
():
redis_client
.
hset
(
session_key
,
key
,
value
)
redis_client
.
hset
(
session_key
,
key
,
json
.
dumps
(
value
)
)
except
:
logging
.
error
(
"index_first:
%
s"
%
traceback
.
format_exc
())
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