-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi_flask.py
More file actions
68 lines (49 loc) · 1.84 KB
/
api_flask.py
File metadata and controls
68 lines (49 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os
import sys
import time
import subprocess
from flask import Flask
from flask import request
messageTosend = 100
banDelay = 86400 / messageTosend
project_root = os.path.dirname(__name__)
template_path = os.path.join(project_root)
app = Flask(__name__,template_folder=template_path)
@app.route('/dm_to_user', methods=['post'])
def dm_to_user():
_username = request.form['username']
_password = request.form['password']
_userTarget = request.form['user_target']
_dm = request.form['dm']
os.system('python3 dm_to_user.py -d '+repr(_dm)+' -t '+_userTarget+' -u '+_username+' -p '+_password)
return 'success'
@app.route('/follow_by_hashtag', methods=['post'])
def follow_by_hashtag():
_username = request.form['username']
_password = request.form['password']
_hashtag = request.form['hashtag']
os.system('python3 bot_follow_where_hashtag.py -u '+_username+' -p '+_password+' hashtags '+_hashtag)
return 'success'
@app.route('/dm_by_following', methods=['post'])
def dm_by_following():
_username = request.form['username']
_password = request.form['password']
_message = request.form['message']
os.system('python3 dm_to_following.py -u '+_username+' -p '+_password+' -d '+repr(_message))
return 'success'
@app.route('/dm_by_followers', methods=['post'])
def dm_by_followers():
_username = request.form['username']
_password = request.form['password']
_message = request.form['message']
os.system('python3 dm_to_followers.py -u '+_username+' -p '+_password+' -d '+repr(_message))
return 'success'
@app.route('/check_info', methods=['post'])
def check_info():
_username = request.form['username']
_password = request.form['password']
proc = subprocess.Popen(["python3 get_info.py -u "+_username+" -p "+_password], stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
return(out)
if __name__ == '__main__':
app.run(debug=False)