basic ass https support

themes
Blake DeMarcy 2018-02-13 22:12:56 -06:00
parent e0f83592dc
commit 33dd0a361d
3 changed files with 10 additions and 3 deletions

View File

@ -49,7 +49,7 @@ class BBJ(object):
See the offical API error documentation for more details.
"""
def __init__(self, host="127.0.0.1", port=7099):
def __init__(self, host="127.0.0.1", port=7099, https=False):
"""
Optionally takes port and host as kwargs. It will immediately
try to resolve a connection to the server, if its down, it
@ -71,7 +71,7 @@ class BBJ(object):
If you set this to False, anonymous network usage is
guaranteed.
"""
self.base = "http://{}:{}/api/%s".format(host, port)
self.base = "http{}://{}:{}/api/%s".format("s" if https else "", host, port)
self.user_name = self.user_auth = None
self.send_auth = True
try:

View File

@ -46,7 +46,7 @@ def get_arg(key, default=None, get_value=True):
return value
try:
network = BBJ(get_arg("host", "127.0.0.1"), get_arg("port", 7099))
network = BBJ(get_arg("host", "127.0.0.1"), get_arg("port", 7099), get_arg("https", False, False))
except URLError as e:
# print the connection error in red
exit("\033[0;31m%s\033[0m" % repr(e))

View File

@ -0,0 +1,7 @@
File "server.py", line 64, in wrapper
value = function(self, body, connection, user)
File "server.py", line 380, in format_message
formatting.apply_formatting(message, formatter)
File "/home/desvox/BBJ/src/formatting.py", line 183, in apply_formatting
if not msg_obj[x]["send_raw"]:
KeyError('send_raw',)