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 5
5
print_function , unicode_literals )
6
6
7
7
import json
8
+ import re
8
9
import requests
9
10
10
11
@@ -26,6 +27,22 @@ class Loklak(object):
26
27
action = None
27
28
data = {}
28
29
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
+
29
46
def status (self ):
30
47
"""Returns the status of the server"""
31
48
status_application = 'api/status.json'
You can’t perform that action at this time.
0 commit comments