Need to get the response status of a webdav client request when my license is expired

Hello, Atlassian Team.

I’m developing a webDAV client on Python and I need to manage the exceptions when the license of a Confluence Server instance is expired.

For example, if I’ll try to make a push request, I need to now which is the server response so I can add it to the exceptions managment.

I tried some POST request with Postman (create and update a space) with a valid license and I’d create the space and updated it successfully.

And when I try the same request with a expired license I get the response 403 - Forbidden, and that’s ok.

But when I ran my WebDAV client script, I’m able to change, create and update all the files, space and pages with the response status 200, and that’s not ok.

What I’m trying to do is force the 403 response when I run the WebDAV client script with a expired license. I was trying with a license expired since December 2019 but I’m not getting the response that I need.

There’s something I’m doing wrong?

Well, I found the solution.

To verify if I have a expired License on Confluence I used the API REST request rest/plugins/1.0/available/atlassian found in this post How do I get licensing information of confluence via rest API ? .

In the response json, there’s a field called “expiryDate” and “expiryDateString”, which both have the date I need to verify the status of my license.

To achieve this I did the following code:

import requests

def verifyLicense(self):

        api_request = "/rest/plugins/1.0/available/atlassian"
        url = self.url+api_request
        headers = {
            'Authorization':'Basic Auth'
        }

        response = requests.get(url, headers=headers, auth=(self.usr, self.key))
        response = response.json()
        expiracion = response['hostStatus']['hostLicense']['expiryDate']
        tstamp = datetime.now().timestamp()

        date_expiracion = datetime.fromtimestamp(expiracion/1000)

        if expiracion/1000 < tstamp:
            return False
        return True

That code reads the timestamp from the Date Due field and compares it to the current date