This commit is contained in:
2021-05-27 15:39:42 +02:00
parent 9a4e9c359d
commit 759f2af603
4 changed files with 27 additions and 28 deletions

View File

@ -1,16 +1,9 @@
from .authclient import AuthClient, AUTH_HEADERS
from .autherror import AuthError
from .authclient import AuthClient, AuthError, AUTH_HEADERS
from .utils import post_request, get_request
class SciCat(AuthClient):
@property
def proposals(self):
url = self.address + "/proposals"
headers = self.auth_headers
return get_request(url, headers=headers)
def authenticate(self, username, password):
url = self.address + "/users/login"
auth_payload = {
@ -26,6 +19,13 @@ class SciCat(AuthClient):
return token
@property
def proposals(self):
url = self.address + "/proposals"
headers = self.auth_headers
return get_request(url, headers=headers)
class SciCatAuthError(AuthError):
pass