Giter Site home page Giter Site logo

client_python's Introduction

client_python

A light wrapper for the Staffjoy API in Python.

This library does not include permissions management, and it is primarily used across microservices internally. Some of its features include internal-only endpoints.

Build Status Moonlight

Installation

pip install --upgrade staffjoy

Authentication

Authentication keys are currently tied to an individual user's account. To issue multiple keys, we currently suggest

  • Permanent: Every Staffjoy account includes a permanent API token that can be accessed from My Account while logged in.
  • Time-based (6-hour): To issue an API token that is valid for 6 hours, visit this link while logged in (note: it is JSON-encoded)
  • Time-based (other lengths): Please email [email protected]

To get your organization ID, look at the URL path when you go to the Manager app while logged in.

Rate Limits

This client sleeps after every request in order to limit requests to 120 per minute. This is done to avoid rate limiting. Staffjoy's API currently rate limits to 300 requests per second across keys and IPs. Thus, by using this library, you should never encounter a rate limit (assuming one executing thread per IP address).

Usage

Start with the client, then traverse the tree.

from Staffjoy import Client

c = Client(key=YOUR_API_KEY)

# To get your organization id, look at the URL path for the Manager
# or email [email protected]
org = c.get_organization(ORG_ID)

# See the org name
print(org.data.get("name))

# See all locations
org.get_locations()

# Add an new location
loc = org.create_location(name="Staffjoy HQ", timezone="America/Los_Angeles")

# Modify its name
loc.patch(name="San Francisco")

# See roles
roles = loc.get_roles()

# Create a role and add a worker for scheduling
role = loc.create_role(name="Mathematicians")
role.create_worker(email="[email protected]")

# Then clean it all up (recursively deletes node children)
loc.delete()

client_python's People

Contributors

philipithomas avatar andhess avatar joshwertheim avatar

Watchers

 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.