-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
93 lines (59 loc) · 2.67 KB
/
app.py
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from flask import Flask, render_template, jsonify
from interface import Pervertgram
with open("config.json") as config:
CREDENTIALS = __import__("json").load(config)
interface = Pervertgram(CREDENTIALS.get("username"), CREDENTIALS.get("password"))
app = Flask(__name__)
@app.route("/")
def index():
return render_template("dp.html")
@app.route("/api/followings/<username>/", defaults={"next_max_id": None})
@app.route("/api/followings/<username>/<next_max_id>")
def api_user_followings(username: str, next_max_id: str):
return jsonify(interface.followings(username, next_max_id=next_max_id))
@app.route("/api/followers/<username>/", defaults={"next_max_id": None})
@app.route("/api/followers/<username>/<next_max_id>")
def api_user_followers(username: str, next_max_id: str):
return jsonify(interface.followers(username, next_max_id=next_max_id))
@app.route("/api/match/<username>/")
def api_matches(username: str):
return jsonify(interface.followed_back(username))
@app.route("/api/location/<username>/", defaults={"next_max_id": None})
@app.route("/api/location/<username>/<next_max_id>")
def api_location_feed(username: str, next_max_id: str):
return jsonify(interface.location_ppl(username, next_max_id=next_max_id))
@app.route("/api/dp/<username>")
def api_hdimage(username: str):
return jsonify(interface.hd_pfp(username))
@app.route("/api/location-people/<int:location>")
def api_location_people(location: int):
return jsonify(interface.location_ppl(location))
@app.route("/api/profile_locations/<username>")
def api_profile_locations(username):
return jsonify(interface.profile_locations(username))
@app.route("/api/likers/<picture_code>")
def api_profile_liker(picture_code: str):
return jsonify(interface.liker(picture_code))
@app.route("/followings/<username>")
def followings(username: str):
return render_template("followship.html", with_page=True)
@app.route("/followers/<username>")
def followers(username: str):
return render_template("followship.html", with_page=True)
@app.route("/match/<username>")
def matches(username: str):
return render_template("followship.html")
@app.route("/location-people/<int:location>")
def location_people(location: int):
return render_template("followship.html")
@app.route("/heatmap/<username>")
def heatmap(username: str):
return render_template("heatmap.html")
@app.route("/dp/<username>")
def pfp(username: str):
return render_template("dp.html", image_url=interface.hd_pfp(username))
@app.route("/likers/<picture_code>")
def liker(picture_code: str):
return render_template("followship.html")
if __name__ == "__main__":
app.run(host="127.0.0.1", port="5002", debug=True)