-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
56 lines (40 loc) · 1.46 KB
/
Copy pathmain.py
File metadata and controls
56 lines (40 loc) · 1.46 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
import json
import os
import requests
import hashtoicon
from icon import display
from flask import Flask, render_template
from market import check_report, check_item
app = Flask(__name__)
@app.route("/")
def home():
return render_template('home.html')
@app.route("/image/<markethash>")
def serve_img(markethash):
return display(hashtoicon.getIcon(markethash))
@app.route('/data')
def data():
# Create a Market instance
# Specify the name of the item you're interested in
response = requests.get("https://prices.csgotrader.app/latest/prices_v6.json")
return response.content
@app.route('/test/<m_start>')
def back(m_start):
# Create a Market instance
# Specify the name of the item you're interested in
return m_start
@app.route('/market/<start>/<end>/<amount>')
def market(start, end, amount):
# def check_report(min_price=1, max_price=2000, acceptable_range_min=-100, acceptable_range_max=100,
# m_start="skinport", m_end="buff163"):
info = json.dumps(check_report(m_start=str(start), m_end=str(end))[0:int(amount)])
# return str(check_report(m_start=str(start), m_end=str(end))[0:int(amount)])
hashlist = []
for item in json.loads(info):
hashlist.append(item)
return display(hashtoicon.getmanyIcons(hashlist))
@app.route('/market/<item_name>')
def item_info(item_name):
return check_item(item_name)
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0", port=int(os.environ.get("PORT", 8080)))