Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ jobs:
- name: Lint with Ruff
run: |
pip install ruff
ruff check --output-format=github --exclude=src/onepassword/lib/ .
ruff check --output-format=github --exclude=src/onepassword/lib/,example/ .
continue-on-error: true
7 changes: 3 additions & 4 deletions example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
from onepassword import *


async def main():
# Gets your service account token from the OP_SERVICE_ACCOUNT_TOKEN environment variable.
token = os.getenv("OP_SERVICE_ACCOUNT_TOKEN")
Expand All @@ -24,7 +23,7 @@ async def main():
id="",
title="MyName",
category="Login",
vault_id="vault_id",
vault_id="q73bqltug6xoegr3wkk2zkenoq",
fields=[
ItemField(
id="username",
Expand All @@ -48,7 +47,7 @@ async def main():
print(dict(created_item))

# Retrieve an item from your vault.
item = await client.items.get("vault_id", created_item.id)
item = await client.items.get(created_item.vault_id, created_item.id)

print(dict(item))

Expand All @@ -59,7 +58,7 @@ async def main():
print(dict(updated_item))

# Delete a item from your vault.
await client.items.delete("vault_id", updated_item.id)
await client.items.delete(created_item.vault_id, updated_item.id)


if __name__ == "__main__":
Expand Down
9 changes: 7 additions & 2 deletions src/onepassword/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from .secrets import Secrets
from .items import Items

import sys
import inspect
import typing

__all__ = [
"Client",
Expand All @@ -14,5 +17,7 @@
"DEFAULT_INTEGRATION_VERSION",
]

if hasattr(types, "__all__"):
__all__ += types.__all__
for name, obj in inspect.getmembers(sys.modules["onepassword.types"]):
# Add all classes and instances of typing.Literal defined in types.py.
if (inspect.isclass(obj) and inspect.getmodule(obj) == sys.modules["onepassword.types"]) or type(eval(name)) == typing._LiteralGenericAlias:
__all__.append(name)