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. 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 Optionally takes port and host as kwargs. It will immediately
try to resolve a connection to the server, if its down, it 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 If you set this to False, anonymous network usage is
guaranteed. 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.user_name = self.user_auth = None
self.send_auth = True self.send_auth = True
try: try:

View File

@ -46,7 +46,7 @@ def get_arg(key, default=None, get_value=True):
return value return value
try: 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: except URLError as e:
# print the connection error in red # print the connection error in red
exit("\033[0;31m%s\033[0m" % repr(e)) 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',)