Rauhan commited on
Commit
5ebc71d
1 Parent(s): c4684f9

UPDATE: adding urls

Browse files
Files changed (2) hide show
  1. app.py +7 -1
  2. functions.py +5 -1
app.py CHANGED
@@ -68,4 +68,10 @@ async def delete(chatbotName: str):
68
 
69
  @app.post("/listChatbots")
70
  async def delete(username: str):
71
- return listTables(username=username)
 
 
 
 
 
 
 
68
 
69
  @app.post("/listChatbots")
70
  async def delete(username: str):
71
+ return listTables(username=username)
72
+
73
+ @app.post("/getLinks")
74
+ async def crawlUrl(baseUrl: str):
75
+ return {
76
+ "urls": getLinks(url=baseUrl, timeout=30)
77
+ }
functions.py CHANGED
@@ -290,4 +290,8 @@ def getLinks(url: str, timeout = 30):
290
  break
291
  else:
292
  uniqueLinks = uniqueLinks.union(set(getLinksFromPage(link)))
293
- return list(set([x[:len(x) - 1] if x[-1] == "/" else x for x in uniqueLinks]))
 
 
 
 
 
290
  break
291
  else:
292
  uniqueLinks = uniqueLinks.union(set(getLinksFromPage(link)))
293
+ return list(set([x[:len(x) - 1] if x[-1] == "/" else x for x in uniqueLinks]))
294
+
295
+
296
+ def getTextLength(text: str):
297
+ return len(text)