jamf-pro-sdk-python icon indicating copy to clipboard operation
jamf-pro-sdk-python copied to clipboard

[Bug] Can't call the ApiClientCredentialsProvider class on import

Open brendan-snyk opened this issue 1 year ago • 4 comments

Simple script:

from jamf_pro_sdk import JamfProClient, ApiClientCredentialsProvider

url="https://test.jamfcloud.com"
client_id="<redacted>"
client_secret="<redacted>"

client = JamfProClient(
    server="snyk.jamfcloud.com",
    credentials=ApiClientCredentialsProvider(client_id, client_secret)
)

all_computers = client.pro_api.get_computer_inventory_v1()
print(all_computers)

This results in: cannot import name 'ApiClientCredentialsProvider' from 'jamf_pro_sdk' (/opt/homebrew/lib/python3.11/site-packages/jamf_pro_sdk/init.py)

Installed: jamf-pro-sdk 0.4a1

brendan-snyk avatar Dec 12 '23 14:12 brendan-snyk

It's missing from here: https://github.com/macadmins/jamf-pro-sdk-python/blob/main/src/jamf_pro_sdk/init.py

brendan-snyk avatar Dec 12 '23 15:12 brendan-snyk

The base client credentials provider will be added to the top-level imports in the next update.

brysontyrrell avatar Dec 29 '23 16:12 brysontyrrell

Howdy @brysontyrrell, any update on when this issue might be resolved? Unless there's a workaround available, this is a pretty big blocker for me using the sdk.

mhrono avatar Jul 23 '24 14:07 mhrono

The ApiClientCredentialsProvider is available as an import using this code:

from jamf_pro_sdk.clients.auth import ApiClientCredentialsProvider

I am planning an overhaul to the credentials providers. Please see #47 for details and to provide feedback.

brysontyrrell avatar Jul 24 '24 02:07 brysontyrrell