Skip to content

Commit 515a613

Browse files
committed
json format defined
1 parent 40bfd8e commit 515a613

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

runner.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
from bottle import route, run, template
22

3-
def fetchLinks(article_name):
4-
#fetch from neo4j here
5-
url_root = "https://en.wikipedia.org/wiki/"
6-
title = "This Is A Test"
7-
return [{ "id": 1, "title": title, "url": generateUrl(title) }, { "id": 2, "name": "Test Item 2" }]
8-
93
@route('/hack17/<article_name>')
104
def returnLinks(article_name):
115
articles = fetchLinks(article_name)
126
return dict(data=articles)
137

8+
def fetchLinks(article_name):
9+
titles = queryGraph(article_name)
10+
title = titles[0]
11+
return [{ "id": 1, "title": titles[0], "url": generateUrl(titles[0]) }, { "id": 2, "name": titles[1], "url": generateUrl(titles[1]) }]
12+
13+
def queryGraph(article_name):
14+
root_title = article_name.replace("_"," ")
15+
titles = ["Perl","Python","Java","C++","Whitespace","OS/2 Warp"]
16+
return titles
17+
1418
def generateUrl(title):
1519
url_root = "https://en.wikipedia.org/wiki/"
1620
return url_root+title.replace(" ","_")

0 commit comments

Comments
 (0)