Example #1
0
def put_thing(url, thing):
    res = requests.post(
              '{0}/things'.format(url),
              data=str(thing),
              headers={'Content-Type': 'application/json'})
    res.raise_for_status()
    return Thing.from_json(res.json())
Example #2
0
def get_thing(url, id):
    res = requests.get('{0}/things/{1}'.format(url, id))
    res.raise_for_status()
    return Thing.from_json(res.json())
Example #3
0
def get_thing(url, id):
    res = requests.get('{0}/things/{1}'.format(url, id))
    res.raise_for_status()
    return Thing.from_json(res.json())
Example #4
0
def put_thing(url, thing):
    res = requests.post('{0}/things'.format(url),
                        data=str(thing),
                        headers={'Content-Type': 'application/json'})
    res.raise_for_status()
    return Thing.from_json(res.json())