File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 55 print_function , unicode_literals )
66
77import json
8+ import re
89import requests
910
1011
@@ -26,6 +27,22 @@ class Loklak(object):
2627 action = None
2728 data = {}
2829
30+ def __init__ (self , baseUrl = 'http://loklak.org/' ):
31+ baseUrl = re .findall ('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+' , baseUrl )
32+ try :
33+ if baseUrl [0 ]:
34+ if baseUrl [0 ] != 'http://loklak.org/' :
35+ url_test = self .hello ()
36+ if url_test ['status' ] == 'ok' :
37+ self .baseUrl = baseUrl [0 ]
38+ else :
39+ self .baseUrl = baseUrl [0 ]
40+ except IndexError :
41+ pass
42+
43+ def getBaseUrl (self ):
44+ return self .baseUrl
45+
2946 def status (self ):
3047 """Returns the status of the server"""
3148 status_application = 'api/status.json'
You can’t perform that action at this time.
0 commit comments