-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
from posit.connect import Client | ||
|
||
with Client() as client: | ||
print(client.get("v1/users")) | ||
print(client.users.get("f55ca95d-ce52-43ed-b31b-48dc4a07fe13")) | ||
|
||
users = client.users | ||
users = users.find(lambda user: user["first_name"].startswith("T")) | ||
users = users.find(lambda user: user["last_name"].startswith("S")) | ||
user = users.find_one(lambda user: user["user_role"] == "administrator") | ||
print(user) | ||
user = client.users.get("f55ca95d-ce52-43ed-b31b-48dc4a07fe13") | ||
print(user.locked) | ||
print(user.is_locked) | ||
|
||
users = client.users.find() | ||
|
||
# This method of conversion provides forward compatibility against the API as fields are removed. This would require | ||
import pandas | ||
|
||
users = (user.asdict() for user in users) | ||
print(pandas.DataFrame(users)) |