1. Home
  2. Docs
  3. API Documentation
  4. Welcome
  5. NewTarget Tutorial – An Example

NewTarget Tutorial – An Example

This is a tutorial meant to assist and demonstrate the use of Kayran’s API Client.

This tutorial is written in the Python programming language, but you can use any other language that matches the requirements.

Import the required Modules/Packages :

import requests

Define the Parameters (can also be done in a form of inputs to variables) :

parameters = {'apiKey': 'your_api_key', 'target': 'desired_full_url', 'autoSpeed': 'on'}

Replace the Keys. For example: ‘your_api_key’ -> ‘aaa-1234-aaa-1234’ , ‘desired_full_url’ -> ‘https://example.com/’ etc…

Define any necessary Headers, Create the Request and save it into a Response :

headers = {'Content-Type': 'application/x-www-form-urlencoded'}
response = requests.post('https://kayran.live/api/NewTarget', data=parameters, headers=headers)

Print the text from the Response :

print(response.text)

On a Successful Response, a Text in a similar form will be displayed :

{“Error”: 0, “Function”: “NewTarget”, “Data”: [{“target”: “https://example.com/”, “status”: “OK”, “token”: “String…”}]}

Errors and their Possible Causes

For more information, please refer to the General Errors section.