forked from Saiselfbotline/rest-API-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
36 lines (32 loc) · 1.13 KB
/
Copy pathapp.py
File metadata and controls
36 lines (32 loc) · 1.13 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
from flask import Flask
from datetime import datetime
import requests, json
app = Flask(__name__)
@app.route('https://bali-tenaya.herokuapp.com/usage') #https://yourdomain.com/
def homepage():
return '''<!DOCTYPE html>
<html>
<head>
<title>arsybai-api</title>
</head>
<body>
<h1>Arsybai API</h1>
<h2>Add me</h2>
<div class="line-it-button" data-lang="en" data-type="friend" data-lineid="arsy22bai" style="display: none;"></div>
<script src="https://d.line-scdn.net/r/web/social-plugin/js/thirdparty/loader.min.js" async="async" defer="defer"></script>
</body>
</html>'''
#======================[ ARSYBAI ]==========================================
@app.route('https://bali-tenaya.herokuapp.com/hello?<string:name>') #https://yourdomain.com/hello?arsybai
def hello(name):
return 'Hello.. how are you {}'.format(str(name))
@app.route('https://bali-tenaya.herokuapp.com/json?') #https://yourdomain.com/json?
def out():
contoh = ['anu','anu1','anu2']
data = {
'status':'OK',
'result':contoh
}
return(json.dumps(data, indent=4, sort_keys=False))
if __name__ == '__main__':
app.run(debug=True, use_reloader=True)