import os
from profound import Profound
client = Profound(api_key=os.environ["PROFOUND_API_KEY"])
# What to fetch — replace with your own values.
CATEGORY_NAME = "<your-category-name>"
def list_owned(category_id):
"""Return (owned_asset_names, owned_domains) for the category."""
names, domains = [], []
for a in client.organizations.categories.assets(category_id):
if not a.is_owned:
continue
names.append(a.name)
if a.website:
domains.append(a.website)
domains.extend(a.alternate_domains or [])
return names, domains
# Helper — translate the category name to the UUID the report API expects.
def find_category_id(name):
"""Return the UUID of the category whose name matches (case-insensitive)."""
for c in client.organizations.categories.list():
if c.name.lower() == name.lower():
return c.id
raise ValueError(f"No category named {name!r}")
# Resolve name → ID, then list owned assets and domains.
category_id = find_category_id(CATEGORY_NAME)
owned_names, owned_domains = list_owned(category_id)
print("Owned assets:")
for n in owned_names:
print(f" - {n}")
print("\nOwned domains:")
for d in owned_domains:
print(f" - {d}")