Skip to content
This repository was archived by the owner on Sep 22, 2020. It is now read-only.

Commit 6536008

Browse files
basic proxying working
1 parent 204d1ab commit 6536008

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

cs_proxy/proxy.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
import simplejson as json
44
import logging
55
import datetime
6+
import requests
7+
68

79
#
810
# HELPERS
911
#
10-
1112
def return_json(object, response):
1213
response.set_header('Content-Type', 'application/json')
1314
return json.dumps(object)
@@ -17,7 +18,7 @@ def return_json(object, response):
1718
#
1819
# BOTTLE APP
1920
#
20-
def run_proxy(env):
21+
def run_proxy(args):
2122

2223
#
2324
# ERROR HANDLERS
@@ -33,15 +34,20 @@ def error500(error):
3334
#
3435
# SPECIAL ENDPOINTS
3536
#
36-
@route('/')
37+
@route('/health')
3738
def hello():
38-
return 'hello there'
39+
return 'ok'
40+
41+
@route('/<url>')
42+
def proxy_trough(url):
43+
return requests.get('{0}{1}'.format(args.githubPagesUrl, url))
44+
3945

4046

4147
#
4248
# RUN BY ENVIRONMENT
4349
#
44-
if env == 'wsgi':
50+
if args.environment == 'wsgi':
4551
run(host='localhost', port=8881, debug=True)
4652
else:
4753
run(server='cgi')

cs_proxy/run_proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ def main():
2424

2525
sys.exit(1)
2626

27-
run_proxy(args.environment)
27+
run_proxy(args)

0 commit comments

Comments
 (0)