Code Monkey home page Code Monkey logo

moffi's Introduction

Moffi SDK and tooling

Installation

pip install -r requirements.txt

Development

  • Use black as formatter with line-length=120 option
  • Use Pylint as linter

SDK

All Moffi-related functions are under moffi_sdk/

See tooling files to get an example of usage

Tooling

Configuration

All tools can take this configuration on 3 way, by priority :

  • From command line args (see --help)
  • From --config command line argument
  • From default config file located at ~/.config/moffi.ini

Moffics - Moffi to ICS proxy

moffics is a simple proxy for Moffi.io API that return the list of your in progress and future reservations as ICS Calendar

Run

python3 moffics.py -h
python3 moffics.py -l 0.0.0.0 -p 8888 -v

You should considerate use https reverse proxy like Caddy (https://caddyserver.com/)

Usage

With basicAuth

If your Webcal ics client support basicAuth, like ICSx⁵ (https://f-droid.org/fr/packages/at.bitfire.icsdroid/) for Android

  • Add a new Calendar to your API root endpoint http://127.0.0.1:8888/ with basic authentication as your Moffi credentials
With a token

If your client does not support basicAuth

  • Start Moffics with a secret key (32 random chars)
python3 moffics.py -s <my 32 chars secret key>
  • Uses standard web client to request a token, using basicAuth
curl -u <moffi username> http://127.0.0.1:8888/getToken

{"token":"<my token>"}
  • Add your calendar to your Webcal app with url http://127.0.0.1:8888/token/<my token>

Simply order a desk

To order a desk for a given date

python order_desk.py -u <moffi username> -p <moffi password> -c <City where to book> -w <Workspace name> -d <Desk full name>

See Moffi web interface to find City, Workspace and Desk names

Auto-Reservation

To order the same desk every possible days, up to 30 days

python auto_reservation.py -u <moffi username> -p <moffi password> -c <City where to book> -w <Workspace name> -d <Desk full name> -t <Date on isoformat>

See Moffi web interface to find City, Workspace and Desk names

It does not order a desk if there is already a reservation for a date, even if reservation is cancelled.

You can define working days to reserve desk only on some days in the week. Define day of week number (Monday is 1) or literral day (eg. Mon, Tue) separated by commas or spaces.

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.