Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
WRansohoff committed Sep 8, 2024
1 parent 7eeb14f commit 1196706
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
9 changes: 3 additions & 6 deletions axiom/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,8 @@ def query(self, apl: str, opts: Optional[AplOptions] = None) -> QueryResult:
def create_api_token(self, opts: TokenAttributes) -> Token:
"""Creates a new API token with permissions specified in a TokenAttributes object."""
res = self.session.post(
'/v2/tokens',
data=ujson.dumps(
asdict(opts),
default=Util.handle_json_serialization
)
"/v2/tokens",
data=ujson.dumps(asdict(opts), default=Util.handle_json_serialization),
)

# Return the new token and ID.
Expand All @@ -293,7 +290,7 @@ def create_api_token(self, opts: TokenAttributes) -> Token:

def delete_api_token(self, token_id: str) -> None:
"""Delete an API token using its ID string."""
self.session.delete(f'/v2/tokens/{token_id}')
self.session.delete(f"/v2/tokens/{token_id}")

def _prepare_query_options(self, opts: QueryOptions) -> Dict[str, object]:
"""returns the query options as a Dict, handles any renaming for key fields."""
Expand Down
1 change: 1 addition & 0 deletions axiom/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@ class Token:
Token contains the response from a call to POST /tokens.
It includes the API token itself, and an ID which can be used to reference it later.
"""

id: str
token: str
6 changes: 2 additions & 4 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
WrongQueryKindException,
DatasetCreateRequest,
TokenAttributes,
TokenOrganizationCapabilities
TokenOrganizationCapabilities,
)
from axiom.query import (
QueryLegacy,
Expand Down Expand Up @@ -226,9 +226,7 @@ def test_api_tokens(self):
"""Test creating and deleting an API token"""
token_attrs = TokenAttributes(
name=f"PytestToken-{uuid.uuid4()}",
orgCapabilities=TokenOrganizationCapabilities(
apiTokens=["read"]
)
orgCapabilities=TokenOrganizationCapabilities(apiTokens=["read"]),
)
token_values = self.client.create_api_token(token_attrs)

Expand Down

0 comments on commit 1196706

Please sign in to comment.