Select to view content in your preferred language

Can't retrieve ArcGIS Pro licenses using gis.admin.license

947
3
06-26-2023 12:33 AM
Labels (3)
HervéW
Emerging Contributor

Hi, 

ArcGIS Pro 2.9.8

ArcGIS Enterprise 10.9.1 (high availability)

We have configured ArcGIS Pro licenses inside Portal for ArcGIS (named user licenses). We are able to assign those licenses to users through the Portal interface. Now, we try to do the same using ArcGIS API for Python.

When I retrieve the license object : 

from arcgis.gis import GIS
 
portal_url = 'portalurl
portalUsername = 'username'
portalPassword = 'password'
 
gis = GIS(portal_url, portalUsername, portalPassword)
license= gis.admin.license
print(license)
licenses = license.all()
print(licenses)
for lic in licenses:
    print(lic)
 
The "license" object is empty, I don't find a way to get my licenses so I can assign a license to a user.
I followed the steps from this page : Administering your GIS | ArcGIS API for Python
 
Any clue why my license object is empty ?
Is there another way to assign ArcGIS Pro licenses from the Portal using ArcGIS API ?
 
Thanks in advance for any suggestions.
 
Regards,
 
Hervé
3 Replies
HervéW
Emerging Contributor

Hi, 

ArcGIS Pro 2.9.8

ArcGIS Enterprise 10.9.1 (high availability)

We have configured ArcGIS Pro licenses inside Portal for ArcGIS (named user licenses). We are able to assign those licenses to users through the Portal interface. Now, we try to do the same using ArcGIS API for Python.

When I retrieve the license object : 

from arcgis.gis import GIS

portal_url = 'portalurl
portalUsername = 'username'
portalPassword = 'password'

gis = GIS(portal_url, portalUsername, portalPassword)
license= gis.admin.license
print(license)
licenses = license.all()
print(licenses)
for lic in licenses:
    print(lic)

The "license" object is empty, I don't find a way to get my licenses so I can assign a license to a user.
I followed the steps from this page : Administering your GIS | ArcGIS API for Python

Any clue why my license object is empty ?
Is there another way to assign ArcGIS Pro licenses from the Portal using ArcGIS API ?

Thanks in advance for any suggestions.

Regards,

Hervé

EdenPunter
Occasional Contributor

Hi @HervéW ,

Check out this post: Python API Not Returning Enterprise Licensing Info... - Esri Community

We solved this by installing Pro 3.1 which comes with arcgis python api version 2.1.

0 Kudos
HervéW
Emerging Contributor

Hi Eden,

Thanks for your reply, we finally managed to attribute ArcGIS Pro licenses using direct access to the REST API.

For the moment, we can't upgrade to ArcGIS Pro 3.1.1, but glad to know that the new API fixed this issue.

Regards,

Hervé

0 Kudos