slight amount of change lol
This commit is contained in:
parent
9be6ca2e3b
commit
cbcdb9f331
7
main.py
7
main.py
|
@ -7,9 +7,12 @@ init_sample.PrintHWInfo(hw)
|
|||
|
||||
# Main app
|
||||
import uJIRA
|
||||
from machine import Pin, TouchPad
|
||||
jcloud = uJIRA.client('tradeprint.atlassian.net')
|
||||
auth = {
|
||||
'method': 'basic-auth',
|
||||
'method': 'basic-auth', #Only basic-auth is supported for now, oauth is a headache
|
||||
'username': '',
|
||||
'password': '',
|
||||
}
|
||||
}
|
||||
|
||||
jcloud.login(auth)
|
||||
|
|
6
uJIRA.py
6
uJIRA.py
|
@ -1,6 +1,7 @@
|
|||
import ussl
|
||||
import urequests
|
||||
import usocket
|
||||
import ubinascii
|
||||
|
||||
class client:
|
||||
def __init__(self, jira_server):
|
||||
|
@ -8,4 +9,7 @@ class client:
|
|||
|
||||
def login(self, params):
|
||||
self.method = params['method']
|
||||
self.username = params['username']
|
||||
if self.method != 'basic-auth':
|
||||
raise ValueError("Authentication method %s not supported by this library." % self.method)
|
||||
self.basic_auth = "%s:%s" % (params['username'], params['password'])
|
||||
self.basic_auth = ubinascii.b2a_base64(("%s:%s" % (params['username'], params['password'])).encode()).decode()[:-1]
|
Loading…
Reference in New Issue