Code Monkey home page Code Monkey logo

mcity-octane-examples's Introduction

Mcity-octane-examples

Included at example scripts utilizing the Mcity OCTANE API implementation for control of the Mcity test facility.

While not all functionality is included, this repository functions as a getting started guide for utilizing parts of the API. Please refer to the latest API documentation at https://mcity.um.city/apidocs for all supported features and functionality.

Core functionality of these examples is storing your user access token (usually in an environment variable), and making requests to the API through either a http request or a Socket.IO websocket. Any language which supports either type of functionality through supporting libraries can be used to access the API.

Servers for usage

The scripts included default to the production environment as they are targeted at users presently renting the facility. The production server is https://mcity.um.city. To acquire a production access key you must rent the Mcity tes facility by scheduling through https://scheduling.um.city

Before your scheduled session, you can utilize these scripts against our test environment by making manual changes within the .html files and the env_sample (or .env) file to switch the server to https://mvillage.um.city

Mvillage is a test environment that mostly mirrors the production environment. At this time, the major difference between the two environments is that that many items will NOT have status tracked/updated and many users can be making requests (that will not be serviced) to the environment. The request notifications will be pushed via the Socket.IO instance, but will not be serviced like production would.

Mvillage for REST requests is effective for verifying message format is correct and seeing what sample responses could look like. Mvillage for Socket.IO is effective for verifying connection, authentication, subscription, request notifications, and all interaction on the USER channel. The socket.IO instance does not provide responses to request or live updates similar to the REST request Mvillage environment.

Documentation

Documentation of the entire application and a test interface is available here: https://mcity.um.city/apidocs You can utilize the documentation interface to submit specific requests, or generate a cURL command to run from a terminal.

Repository Structure

jquery-socketio.html - Sample jquery application that runs requests and handles/parses responses. python-socketio.ipynb - A Jupyter notebook containing python code equivalent to the jQuery SocketIO example python-rest.ipynb - A Jupyter notebook containing python code equivalent to the jQuery REST example. python-socketio.py - A very basic SocketIO client that handles authentication. python-rest.py - A very basic Python script executing a few calls to the REST API. python-v2x.py - An example script aimed at use in the Ann Arbor Connected Environment. Connects/Queries a specific Parsed RSU SPaT feed.

Installation

Clone the package

git clone https://github.com/mcity/Mcity-octane-examples.git

jQuery examples

Run HTML page directly in browser and view the code while running each example.

Python examples

Copy env_sample to .env file in your directory

$ cp env_sample .env

Insert your access token into the .env file.

$ vi .env

Create a virtual environment

$ python3 -m venv venv
$ source venv/bin/activate

Install required packages

$ pip install -r requirements.txt

Start Jupyter Notebooks

$ jupyter notebook

Start scripts

$ python python-socketio.py

Development

If you'd like to contribute to this repository, please create a pull request for features or fixes. Questions can be directed to [email protected]

mcity-octane-examples's People

Contributors

tsworman avatar gmcguire avatar dependabot[bot] avatar eserzomcity avatar

Watchers

James Cloos avatar

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.