GithubHelp home page GithubHelp logo

panoramic-auth-py's Introduction

Panoramic Auth SDK

Build Status Last Commit Latest Release License PyPI Download

Getting Started

This SDK handles the access token generation using client_credentials flow against Panoramic. To install the SDK in your app, add it to your requirements.txt:

panoramic-auth==1.0.0

All you then need to do is subclass the OAuth2Client Python class from the SDK, pass your client_id and client_secret, and use the session attribute from your subclass when making HTTP requests:

# Import the class as usual
from panoramic.auth import OAuth2Client

# Note subclassing OAuth2Client below
class PanoramicApiClient(OAuth2Client):
    def __init__(self, base_url: str, client_id: str, client_secret: str):
        super().__init__(client_id, client_secret)
        self.base_url = base_url
   
    def async_data(self, data: Dict[str, Any]) -> Dict[str, Any]:
        url = urljoin('https://platform.panoramichq.com/api/example')
        # Note self.session below
        response = self.session.post(url=url, json=data)
        response.raise_for_status()
        return response.json()

Development

This repository does not have a dedicated docker image. At the moment, we create python virtual environment using command (in directory .venv inside current directory):

> python3 -m venv .venv

If you use pyenv and pyenv-virtualenv, you can create it using:

> pyenv virtualenv panoramic-auth

Then, you can switch to it from command-line using following command:

> source .venv/bin/activate

Or if using pyenv-virtualenv:

pyenv local panoramic-auth

Lastly, use following command to install dependencies (make sure you have correct python environment active):

> make install

Install pre-commit - useful to avoid commiting code that doesn't pass the linter:

> make pre-commit-install

This installs git hooks that run pre-commit.

Tests

Use following command to run all tests:

> make tests

Release process

To release a new version of the library, follow these steps:

  • In your PR, update version in setup.py and add entry to CHANGELOG.md
  • After merge, tag the commit with version number from setup.py. For example git tag v0.1.1. You can also do this by creating a new release.
  • This triggers a Travis pipeline which runs tests, linters and uploads the package to PyPI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.