Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Roborian/outsetapy
Browse files Browse the repository at this point in the history
  • Loading branch information
savelkouls committed Apr 6, 2024
2 parents efde276 + 41150cc commit 6e23312
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "outsetapy"
version = "0.1.4a"
version = "0.1.5"

authors = [
{ name="Roborian, Inc", email="[email protected]" },
Expand Down
14 changes: 7 additions & 7 deletions src/outsetapy/api/user/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from outsetapy.util.store import Store
from outsetapy.util.request import Request
from outsetapy.util.credentials import UserCredentials
from .profile import Profile
from .password import Password

Expand All @@ -21,17 +22,16 @@ async def login(self, username: str, password: str) -> LoginResponse:
request = Request(self.store, "tokens").with_body(
{
"username": username,
"password": password,
"grant_type": "password",
"client_id": "outseta_auth_widget",
"password": password
}
)
response = await request.post()
response = request.post()
if not response.ok:
raise Exception(response)
raise Exception(response.content)

response_body = response.json()
self.store.user_auth.access_token = response_body["access_token"]

self.store.user_auth = UserCredentials(response_body["access_token"])
return response_body

async def impersonate(self, username: str) -> LoginResponse:
Expand All @@ -47,7 +47,7 @@ async def impersonate(self, username: str) -> LoginResponse:
}
)
)
response = await request.post()
response = request.post()
if not response.ok:
raise Exception(response)

Expand Down
6 changes: 3 additions & 3 deletions src/outsetapy/api/user/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ async def get(self, fields: Optional[str] = None) -> Person:

if not response.ok:
raise Exception(response)
return Person(response.json())
return Person(response.json(), self.store)

async def update(
self, profile: ProfileUpdate
) -> Union[Person, ValidationError[Person]]:
) -> Person:
request = (
Request(self.store, "profile").authenticate_as_user().with_body(profile)
)
Expand All @@ -37,6 +37,6 @@ async def update(
if response.status == 400:
raise Exception(response.json())
elif response.ok:
return Person(response.json())
return Person(response.json(), self.store)
else:
raise Exception(response)
2 changes: 1 addition & 1 deletion src/outsetapy/static.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
OUTSETAPY_VERSION = "0.1.4a"
OUTSETAPY_VERSION = "0.1.5"

0 comments on commit 6e23312

Please sign in to comment.