Skip to content

[Jira] Getting license information with remaining seats #931

@Caramba77

Description

@Caramba77

Hello,
I want to add a function in order to get the license information and be notified when remaining license are at a low threshold.

Prepared this in order to do it
def get_license_info(self): """ Checks the status and license information including active users """ url = "rest/plugins/applications/1.0/installed/jira-software/" return self.get(url)
From a browser the URL returns all the information fine.
In the python script, I get a 406 error
raise JSONDecodeError("Expecting value", s, err.value) from None JSONDecodeError: Expecting value

But if I use this request to do it, it's perfectly fine...
Anyone would know why ?
def getLicenceInfo(): headers = { 'Accept': '*/*',} url= 'https://jira/rest/plugins/applications/1.0/installed/jira-software' r=requests.get(url=url,headers=headers,auth=("user","password")) print(r.status_code) data=json.loads(r.text) activeUsers = data['accessDetails']['activeUserCount'] print("There are currently %d counted towards JIRA Software License" % (activeUsers)) licensedUsers = data['accessDetails']['licensedUserCount'] remainingLicenses= licensedUsers - activeUsers print("There are %d licenses left" % (remainingLicenses))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions