HomeGuidesRecipesAPI EndpointsRelease NotesCommunity
Log In

Installing the Layar API

The Layar API can be consumed in a few different ways: as a software developers kit (SDK) package from GitHub, through your Layar instance's Swagger documentation, and as a Postman collection. Here, we will be showing you how to download and install the Github SDK Package.

Installing the Layar API SDK Package

Open your computer’s terminal and enter the following command to install the Layar API SDK into your project:

pip3 install git+https://github.com/vyasa-analytics/layar-api-python.git

🚧

Check Your PIP Version

The newer versions of Python (3.0+) use pip3. If you get an error message that read command not found: pip3 you should update your python package to Python 3, which is what we support for our API. Learn more. .

Now that you have the Layar API installed it’s time to start building! If you are adding the Layar API to a project already have, you can skip down to Importing Requirements. Otherwise, you’ll need a new document.

Creating a New Document

The first thing we need is a place to write your application! You can name this whatever you like as long as there are no spaces. You can use underscores between words to keep it readable. It is also common practice to keep your filenames all lowercase. For the purposes of this tutorial, we will be using main.py and referring to your top-level document as the “root document”. There are a few ways to add a document to your project. Pick the one that you are most comfortable with.

From The Command Line

You can create a new file from your Terminal by using the touch command. First, make sure you are in your project directory as we went over in Setting Up Your Environment, and then run:

touch main.py

This will create a blank python script file. You can open this file to start typing your API script by using the open command:

open main.py

From VS Code

If you are using VSCode you can add new files very easily by using the “New File button at the top of the Explorer tab.

690

Importing Requirements

Alright! We have Layar installed and a fresh new document to work in. Now we need to tell our project that we’ll be using the packages we installed earlier.

In any guides or recipes you see in this documentation, you'll see a block of dependencies to import. These packages only need to be imported in your project once.

At the top of your root (main) document you’ll want to import the following packages:

# Import Dependencies
import layar_api
from layar_api.rest import ApiException
import requests

from __future__ import print_function
from pprint import pprint
import time

👍

Layar API & Dependencies Installed

Success! You've now installed the SDK and all of the dependencies needed to use the Layar API.


Up Next

You've now set up your environment and installed the necessary languages and dependencies. The last step before making any API calls is to configure and authenticate your instance.