Hey guys I have been trying to use the `ory-client...
# ory-network
m
Hey guys I have been trying to use the
ory-client
python sdk but having some issues. i installed
ory-client
but in using the sdk, for even the test tutorial(https://github.com/ory/sdk/blob/master/clients/client/python/docs/MetadataApi.md#get_version), i get the error:
Copy code
NotFoundException: Status Code: 404 Reason: Not Found HTTP response headers: HTTPHeaderDict({'Date': 'Mon, 08 May 2023 00:44:14 GMT', 'Content-Type': 'application/json', 'Content-Length': '144', 'Connection': 'keep-alive', 'vary': 'Origin', 'ory-network-request-id': '76b94ada-2bf2-90ea-a381-74edd712181c', 'CF-Cache-Status': 'DYNAMIC', 'Set-Cookie': '__cflb=0H28vgXdDEYCN6ddXsaRCbLqjUk6h4A7eP8HnHf9dF1; SameSite=None; Secure; path=/; expires=Mon, 08-May-23 01:44:14 GMT; HttpOnly', 'Server': 'cloudflare', 'CF-RAY': '7c3dac50cb9d23bf-LHR', 'alt-svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400'}) HTTP response body: {"error":{"code":404,"status":"Not Found","request":"76b94ada-2bf2-90ea-a381-74edd712181c","message":"Requested url does not match any rules"}}
Is there any idea on how i can fix this or if i'm missing to set up something that wasn't included in the docs?
b
Could you post the configuration for the SDK?
m
i tried the default one:
Copy code
configuration = ory_client.Configuration(
    host = "<https://playground.projects.oryapis.com>"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: oryAccessToken
configuration = ory_client.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)
then tried something specific for my project:
Copy code
configuration = ory_client.Configuration(
    host = "<https://elegant-liskov-q3be2292gk.projects.oryapis.com/>"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: oryAccessToken
configuration = ory_client.Configuration(
    access_token = 'ory_pat_AslFFXTtz05uRwbia5fwKiAiP6wZuNpp'
)
both the same result
b
can you try removing the / from the end of the host definition in your second example? I am not sure if the playground project has all endpoints enabled.
m
yeah, i removed the / but same thing. apparently the following apis dont work with ory network https://www.ory.sh/docs/reference/api#tag/metadata/operation/isAlive https://www.ory.sh/docs/reference/api#tag/metadata/operation/isReady https://www.ory.sh/docs/reference/api#tag/metadata/operation/getVersion so i tried the https://www.ory.sh/docs/reference/api#tag/identity/operation/listIdentities API, i'm guessing the configuration works (sort of) because i get a different kind of error now
Copy code
Exception when calling IdentityApi->list_identities: Status Code: 403
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Date': 'Mon, 08 May 2023 19:49:30 GMT', 'Content-Type': 'application/json', 'Content-Length': '167', 'Connection': 'keep-alive', 'vary': 'Origin', 'ory-network-request-id': 'ebf2bb33-c0e9-9b3a-ba64-4736453a41be', 'CF-Cache-Status': 'DYNAMIC', 'Set-Cookie': '__cflb=0H28vgXdDEYCN6ddXsaRCbLqjUk6h4A7b43pWRyFLqZ; SameSite=None; Secure; path=/; expires=Mon, 08-May-23 20:49:30 GMT; HttpOnly', 'Server': 'cloudflare', 'CF-RAY': '7c4439f39ceb23b9-LHR', 'alt-svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400'})
HTTP response body: {"error":{"code":403,"status":"Forbidden","request":"ebf2bb33-c0e9-9b3a-ba64-4736453a41be","message":"Access credentials are not sufficient to access this resource"}}
although, i am unsure, looking at the error message, on what access credentials are needed to access my resource. as a context, i used my host and access token(which is the api key). what more do i require to work with Ory apis?