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
918fac34
Commit
918fac34
authored
Aug 10, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
0db1078a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
44 deletions
+64
-44
trans2es_mapping2es.py
trans2es/management/commands/trans2es_mapping2es.py
+5
-0
auto_user_id.py
vest/request/auto_user_id.py
+11
-7
get_session.py
vest/request/get_session.py
+48
-37
No files found.
trans2es/management/commands/trans2es_mapping2es.py
View file @
918fac34
...
...
@@ -13,6 +13,7 @@ from vest.follow import auto_follow, auto_follow_new
from
vest.urge
import
auto_star_urge
,
auto_lunch_app
,
auto_lunch_app2
,
auto_urge1
,
auto_urge2
from
vest.fix
import
fix_no_comment_click
from
vest.reply_answer
import
reply_comment2
,
reply_comment3
,
answer_reply2
,
answer_reply3
,
answer_reply1
from
vest.request
import
get_session
,
auto_request
,
auto_user_id
class
Command
(
BaseCommand
):
...
...
@@ -120,6 +121,10 @@ class Command(BaseCommand):
reply_comment3
.
reply_comment3
()
# 获得session和use_id
if
options
[
"mvest"
]
==
"get_login_session"
:
get_session
.
get_session
()
if
options
[
"mvest"
]
==
"get_user_id"
:
auto_user_id
.
auto_user_id
()
...
...
vest/request/auto_user_id.py
View file @
918fac34
...
...
@@ -31,11 +31,15 @@ def get_data():
return
None
data
=
get_data
()
print
(
data
)
file
=
open
(
"/srv/apps/physical/vest/data/user_id.txt"
,
"w"
)
def
auto_user_id
():
try
:
data
=
get_data
()
print
(
data
)
file
=
open
(
"/srv/apps/physical/vest/data/user_id.txt"
,
"w"
)
if
data
:
for
i
in
data
:
file
.
write
(
str
(
i
[
0
]))
file
.
write
(
"
\n
"
)
if
data
:
for
i
in
data
:
file
.
write
(
str
(
i
[
0
]))
file
.
write
(
"
\n
"
)
except
:
logging
.
error
(
"index_first:
%
s"
%
traceback
.
format_exc
())
vest/request/get_session.py
View file @
918fac34
...
...
@@ -17,40 +17,51 @@ def index_first():
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
=
{
'account_type'
:
2
,
'pwd'
:
'123456'
,
'email'
:
i
}
response
=
requests
.
post
(
url
=
login_url
,
data
=
post_dict
,
cookies
=
cookies
)
headers
=
response
.
headers
print
(
response
.
text
)
cook
=
headers
[
'Set-Cookie'
]
.
split
(
";"
)
cook
=
cook
[
0
]
.
split
(
'='
)[
1
]
logging
.
info
(
"response.text :
%
s"
%
response
.
text
)
dicts
[
i
]
=
cook
return
dicts
dicts
=
get_cook
()
with
open
(
"/srv/apps/physical/vest/data/user_session.txt"
,
'w'
)
as
f
:
for
key
,
value
in
dicts
.
items
():
f
.
write
(
key
)
f
.
write
(
","
)
f
.
write
(
value
)
f
.
write
(
"
\n
"
)
try
:
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
=
{
'account_type'
:
2
,
'pwd'
:
'123456'
,
'email'
:
i
}
response
=
requests
.
post
(
url
=
login_url
,
data
=
post_dict
,
cookies
=
cookies
)
headers
=
response
.
headers
print
(
response
.
text
)
cook
=
headers
[
'Set-Cookie'
]
.
split
(
";"
)
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
())
return
None
def
get_session
():
try
:
dicts
=
get_cook
()
with
open
(
"/srv/apps/physical/vest/data/user_session.txt"
,
'w'
)
as
f
:
for
key
,
value
in
dicts
.
items
():
f
.
write
(
key
)
f
.
write
(
","
)
f
.
write
(
value
)
f
.
write
(
"
\n
"
)
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