Skip to content

Commit

Permalink
Fix Testaustime branding
Browse files Browse the repository at this point in the history
Nothing broke!(?)
  • Loading branch information
HEPOSHEIKKI authored Jun 23, 2023
1 parent f517427 commit e46f93c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions testaustime.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
can_show_missing_key_popup = True


class TestausTime:

class testaustime:
def __init__(self):
self.settings = sublime.load_settings(PLUGIN_SETTINGS_KEY)
if not self.get_endpoint_url():
Expand Down Expand Up @@ -48,7 +49,7 @@ def get_endpoint_url(self):
if endpoint:
return str(endpoint)

if TestausTime().get_api_key():
if testaustime().get_api_key():
sublime.status_message(" testaustime is ready. happy coding")
else:
sublime.status_message(" testaustime API token not set")
Expand All @@ -59,7 +60,7 @@ def run(self):

def _on_input_done(self, user_input):
sublime.message_dialog("API key set")
TestausTime().save_api_key(user_input)
testaustime().save_api_key(user_input)



Expand All @@ -73,12 +74,12 @@ def _on_input_done(self, user_input):
user_input = "https://" + user_input
if user_input.endswith("/"):
user_input = user_input[:-1]
TestausTime().save_endpoint_url(user_input)
testaustime().save_endpoint_url(user_input)

class ApiCredHandler(sublime_plugin.TextCommand):
def retrieve_api_key(self, edit):
api_key = prompt_api_key()
TestausTime.save_api_key(api_key)
testaustime.save_api_key(api_key)

class get_project_name(sublime_plugin.TextCommand):
def run(self, edit):
Expand All @@ -94,9 +95,9 @@ def AsyncApiCall(self, timeout, endpoint, has_body):
try:
if assemble_data() and assemble_headers():
if has_body:
request = urllib.request.Request(TestausTime().get_endpoint_url() + endpoint, data=assemble_data(), headers=assemble_headers())
request = urllib.request.Request(testaustime().get_endpoint_url() + endpoint, data=assemble_data(), headers=assemble_headers())
else:
request = urllib.request.Request(TestausTime().get_endpoint_url() + endpoint, headers=assemble_headers())
request = urllib.request.Request(testaustime().get_endpoint_url() + endpoint, headers=assemble_headers())
response = urllib.request.urlopen(request)
response_text = response.read().decode('utf-8')
return response_text
Expand Down Expand Up @@ -139,10 +140,10 @@ def assemble_data():
return data

def assemble_headers():
if TestausTime().get_api_key():
if testaustime().get_api_key():
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + TestausTime().get_api_key(),
'Authorization': 'Bearer ' + testaustime().get_api_key(),
}
return(headers)

Expand Down

0 comments on commit e46f93c

Please sign in to comment.