Giter VIP home page Giter VIP logo

pyrple's Introduction

pyrple

Python wrapper to make simple GET requests with the Purple Wifi API.

Purple Wifi is an enterprise SAAS platform for managing public wifi access across large commercial estates such as property developments, stadiums, or public transportation. The Purple platform comes with a RESTFUL API that can be used to retrieve data about the wifi venues and visitors who have connected to the public wifi.

Pyrple is a simple Python wrapper around the Purple API to allow really simple requests to get visitor, venue, and other data out of the platform.

Installation

Pyrple is available for download via pypi:

pip install -U pyrple

Usage

First create an API instance using public and private keys.

For example, loading credentials from a dictionary:

keys = {"public_key": "abcdefghij123454KLMnoP123",
        "private_key": "qrstuv98765434WxyZ"}

we can then create the API instance with:

my_purple = purple(public_key = keys["public_key"], private_key = keys["private_key"])

Data can now be retrieved using the built-in methods:

my_purple.venues()

returns a simple json dictionary of all Purple wifi venues with their unique IDs.

my_purple.venues_json()

returns a json dictionary of Purple Wifi venues with full details.

my_purple.visitor_json(venue = "12345")

returns a json dictionary of all visitor info for the specified venue ID. By default it will produce all visitors currently connected at the venue, but optional parameters of date_from and date_to can be supplied in format YYYYMMDD to report on historic data from the given date range.

Example

In:

from pyrple import purple

# Replace with your Purple API keys.
keys = {"public_key": "abcdefghij123454KLMnoP123",
        "private_key": "qrstuv98765434WxyZ"}
        
my_purple = purple(public_key = keys["public_key"], private_key = keys["private_key"])
my_purple.venues()

Out:

{u'Venue 1 - entrance': 52133,
 u'Venue 2 - podium': 44663,
 u'Basement 1': 11223,
 u'Basement 2': 22336,
 u'Residents 1': 51234}

pyrple's People

Contributors

toby-p avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

liberty1776dtom

pyrple's Issues

region support

The code doesn't work for other regions.
enhancement to support regions which means updating purpleportal strings to prefix with e.g region3 so region3.purpleportal.net instead of just purpleportal.net

invalid date error

The request_time should be refreshed in __generate_header or you will get 401 invalid date errors on API calls after a period of time.

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.