You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that an image_url is returned when using organizations.upload_logo_async. Is it possible to return the image_url as part of organizations.get_async?
Alternatively, is there another way to obtain the logo's url?
The text was updated successfully, but these errors were encountered:
Returns with the actual image_url (Not documented in the BAPI docs either
All that's need to be done is to extend the python SDK Organization object like this, and it works:
from httpx import get
from utils.app_settings import APP_SETTINGS
from clerk_backend_api import Organization
class ExtendedOrganization(Organization):
image_url: str | None
class OrganizationNotFoundException(Exception):
pass
def get_organization_info(org_id: str) -> ExtendedOrganization:
# Try manually request without sdk
resp = get(
f"https://api.clerk.com/v1/organizations/{org_id}",
headers={"Authorization": f"Bearer {APP_SETTINGS.clerk_secret_key}"},
)
if resp.status_code == 404:
raise OrganizationNotFoundException(f"Organization with id {org_id} not found")
if resp.status_code != 200:
logger.error(f"Failed to get organization with id {org_id}, error: {resp.text}")
raise Exception(f"Failed to get organization with id {org_id}")
organization = ExtendedOrganization.model_validate(resp.json())
return organization
# Then later just access it via:
get_organization_info(your_org_id).image_url
I see that an image_url is returned when using
organizations.upload_logo_async
. Is it possible to return the image_url as part oforganizations.get_async
?Alternatively, is there another way to obtain the logo's url?
The text was updated successfully, but these errors were encountered: