Python SDKs

The Python SDK can be used to fetch analytics data, render search results, and obtain information on content source data.

Prerequisite

Install python 3.0 or higher.

Ensure that your profile is in the right scope. Refer to Change User Scope (API and SDK).

Initialization

Before using SDK you must have to initialize first. In this process you just need to ensure authentication. We have two methods to generate and refresh access tokens. After initializing SDK you can access SearchUnify analytics, content and search.

 

Copy

Initialize Python SDK

from searchunify import startClient, refreshToken
username = "**************"
password = "**************"
clientId = "**************"
secrets =  "**************"
url= "yourcompany.searchunify.com"
result = startClient(username=username, password=password,clientId=clientId, secrets=secrets, instance=url)

The access token expires every four hours. You can refresh it with the refreshToken() function.

Copy

Generate refresh token

from searchunify import startClient, refreshToken
result = refreshToken()

Analytics

To access analytics data you can use analytics functions. There are around 22 methods for various use cases.

Content

This includes the methods for content source APIs. If you want to use content APIs can directly use these functions.

Search

SDK has a search API to make content searchable. You just need to pass parameters as per requirement.