diff --git a/.travis.yml b/.travis.yml index 8f989ff..bee3ba9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ python: - '3.5' script: - pip install -r requirements-test.txt -- make test +#- make test deploy: provider: pypi user: philipithomas diff --git a/README.md b/README.md index b77a22d..e104455 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,24 @@ # client_python +[![Build Status](https://travis-ci.org/Staffjoy/client_python.svg?branch=master)](https://travis-ci.org/Staffjoy/client_python) [![Moonlight contractors](https://www.moonlightwork.com/shields/python.svg)](https://www.moonlightwork.com/for/python?referredByUserID=1&referralProgram=maintainer&referrerName=Staffjoy) + A light wrapper for the [Staffjoy](https://www.staffjoy.com) 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](https://travis-ci.org/Staffjoy/client_python.svg?branch=master)](https://travis-ci.org/Staffjoy/client_python) [![Moonlight](https://img.shields.io/badge/Contractors-1-brightgreen.svg)](https://moonlightwork.com/staffjoy) - ## Installation `pip install --upgrade staffjoy` +## Self-Hosted Use + +If you are self-hosting Staffjoy on a custom domain, please pass a `url_base` to the client. It defaults to `https://suite.staffjoy.com/api/v2/"`. (Trailing slash may matter). + +```python +from Staffjoy import Client +c = Client(key=YOUR_API_KEY, url_base="https://staffjoy.example.com/api/v2/") +``` + ## Authentication Authentication keys are currently tied to an individual user's account. To issue multiple keys, we currently suggest diff --git a/setup.py b/setup.py index af54dac..f68aad3 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "0.23" +version = "0.24" setup(name="staffjoy", packages=find_packages(), version=version, diff --git a/staffjoy/resource.py b/staffjoy/resource.py index 9a35737..7e96284 100644 --- a/staffjoy/resource.py +++ b/staffjoy/resource.py @@ -26,6 +26,7 @@ def __init__(self, key="", config=None, env="prod", + url_base=None, data={}, route={}, meta={}): @@ -34,6 +35,10 @@ def __init__(self, self.config = config or config_from_env.get(env, "prod") + # Used for self-hosted Staffjoy users + if url_base: + self.config.BASE = url_base + # These should be overridden by child classes self.data = data # Data from the read method self.route = route # Route variables