A library that makes consuming a RESTful API easier and more convenient

Overview

Slumber Build status Test coverage percentage Documentation

Slumber is a Python library that provides a convenient yet powerful object-oriented interface to ReSTful APIs. It acts as a wrapper around the excellent requests library and abstracts away the handling of URLs, serialization, and request processing.

Getting Help

Visit IRC channel (#slumber on irc.freenode.net) to get help, bounce ideas or generally shoot the breeze.

QuickStart

  1. Install Slumber:

    $ pip install slumber
    
  2. Install Optional Requirement:

    pip install pyyaml
    
  3. Use Slumber!

Requirements

Slumber requires the following modules.

  • Python 2.6+
  • requests
  • pyyaml (If you are using the optional YAML serialization)
Comments
  • Hand over project to new maintainers or officially deprecate it

    Hand over project to new maintainers or officially deprecate it

    People keep reporting bugs and working on patches. Without our interest and feedback, that’s time and energy lost. I think handing over or closing the project would be a good move at this point.

    opened by merwok 25
  • Use requests' guess_json_utf() to specify an encoding for decode()

    Use requests' guess_json_utf() to specify an encoding for decode()

    If a response's content contains Unicode, Slumber will attempt to decode it without specifying an encoding. The lack of an encoding causes an error.

    This PR addresses this issue by using an approach similar to that used by requests itself: using request's guess_json_utf() helper to detect which encoding to use, and then specifying the proper encoding to decode().

    opened by rlucioni 16
  • Having a /.../get/.../ URI

    Having a /.../get/.../ URI

    Hello,

    I didn't find any help on the documentation or in the submitted issues about this.

    How can I do a request like:

    api = slumber.Api()
    api.master.object.get.prop.get()
    

    so the api call the URI /master/object/get/prop/ ?

    Thanks

    opened by FlogFr 9
  • json no longer get parsed (contenttype application/json; charset=utf-8)

    json no longer get parsed (contenttype application/json; charset=utf-8)

    The service I use sets the content type header to

    application/json; charset=utf-8
    

    This doesn't match any of the serializers, even though it's clearly json and worked before.

    opened by jaap3 8
  • Fixed a glitch in the params to a GET following a POST 201

    Fixed a glitch in the params to a GET following a POST 201

    This is probably an edge case only I'm hitting - I'm using username+api_key get params to authenticate during a POST. These get garbled in the subsequent GET.

    One line fix, but popped a test in anyway.

    opened by ghost 7
  • Send Content-Type only if there is data, relative post location

    Send Content-Type only if there is data, relative post location

    Sorry for two fixes in single pull request.

    PUT and DELETE methods should only send Content-type header if there request has data.

    If Location header is not full URL (doesn't start with http/s) it can be passed as id parameter and url_join function will join Location with base_path.

    opened by bancek 6
  • Update PyPi package

    Update PyPi package

    Hello,

    is there any plans to update PyPi package since slumber works with Python 3 now? If there is something blocking I'd be happy to help.

    Best, Alex.

    opened by irqed 5
  • Add 'files' parameter to POST; PUT and PATCH methods

    Add 'files' parameter to POST; PUT and PATCH methods

    As we discussed, I think this is a better implementation of files support. I also refactored a bit of repeated code. Let me know what you think. Cheers.

    opened by dgaus 5
  •  Travis CI: Add Python 3.5 and 3.7 and drop EOL Pythons

    Travis CI: Add Python 3.5 and 3.7 and drop EOL Pythons

    Python 2.6 end of life was five years ago. Python 3.4 is end of life. https://docs.python.org/devguide/index.html#branchstatus

    • Travis CI: Add Python 3.5 and 3.7 and drop EOL Pythons
    • tox.ini: envlist = py27, py35, py36, py37, pypy, report
    opened by cclauss 4
  • Skip SSL verification

    Skip SSL verification

    Hi slumber,

    I appreciate your library very much but i run into an issue, when i'm requesting a REST-API with an unverified SSL certificate. In the python requests module i have the opportunity set the verify parameter to False. I missed this in your implementation i have created a clone of your project and implemented it myself. If you are interested you can take a look, it wasn't that much work :-)

    my clone is here: https://github.com/ceasaro/slumber_clone/commit/f410cfb6a78f6751ef64027a4580ec12133e66aa

    kind regard,

    Cees van Wieringen.

    opened by ceasaro 4
  • Why all the header clobbering?

    Why all the header clobbering?

    In the get, put, post, patch methods, the only thing that is returned is the content. What about the headers?

    Some APIs respond with info in the headers rather than the body, so this is all lost.

    opened by stringfellow 4
  • test_yaml_get_serializer failing

    test_yaml_get_serializer failing

    A test is failing in the testsuite:

    [    4s] ======================================================================
    [    4s] FAIL: test_yaml_get_serializer (tests.serializer.ResourceTestCase)
    [    4s] ----------------------------------------------------------------------
    [    4s] Traceback (most recent call last):
    [    4s]   File "/home/abuild/rpmbuild/BUILD/slumber-0.7.1/tests/serializer.py", line 43, in test_yaml_get_serializer
    [    4s]     self.assertEqual(result, "{foo: bar}\n")
    [    4s] AssertionError: 'foo: bar\n' != '{foo: bar}\n'
    [    4s] 
    [    4s] ----------------------------------------------------------------------
    [    4s] Ran 35 tests in 0.012s
    
    

    Could you please help me understand why?

    opened by pgajdos 1
  • Delete can't contain data

    Delete can't contain data

    Some APIs require to send data through the HTTP delete request. The slumber doesn't allow this, so I have to use this hack:

            resp = self.api.lists(self.list_id).unsubscribe._request(
                "DELETE",
                data={"email": email},
            )
            if not 200 <= resp.status_code <= 299:
                raise Exception("Not unsubscribed")
    
    opened by PetrDlouhy 0
  • Use format arg in resources

    Use format arg in resources

    Documentation page https://slumber.readthedocs.io/en/v0.6.0/options.html#serializer says that we can define a certain format for each resource, but this was not taken into an account. PR adds this behavior and fixes #131.

    opened by amureki 2
  • http://slumber.readthedocs.io defaults to 0.6.0

    http://slumber.readthedocs.io defaults to 0.6.0

    The 0.6.0 docs do not include things like how to pass a requests session to the API class. The latest docs are also available on slumber.readthedocs.io, but the v0.6.0 at the bottom left of the page doesn't open the menu to choose latest. On the other hand, the bottom left menu in latest works so that the user can go back to 0.6.0 IMHO maybe just set latest to be the default landing page for the docs, with earlier versions being optional.

    Related: https://github.com/samgiles/slumber/pull/114

    opened by shadiakiki1986 0
  • Use ? instead of / for API action

    Use ? instead of / for API action

    Hi,

    I have an API url like "https://exmaple.com/api?login". Slumber generates the URL as "https://exmaple.com/api/login" which does not work.

    append_slash=False is set.

    How can I switch the seperator to "?"?

    opened by kevin-olbrich 0
Flask-Potion is a RESTful API framework for Flask and SQLAlchemy, Peewee or MongoEngine

Flask-Potion Description Flask-Potion is a powerful Flask extension for building RESTful JSON APIs. Potion features include validation, model resource

DTU Biosustain 484 Feb 3, 2021
Restful API framework wrapped around MongoEngine

Flask-MongoRest A Restful API framework wrapped around MongoEngine. Setup from flask import Flask from flask_mongoengine import MongoEngine from flask

Close 525 Jan 1, 2023
Restful API framework wrapped around MongoEngine

Flask-MongoRest A Restful API framework wrapped around MongoEngine. Setup from flask import Flask from flask_mongoengine import MongoEngine from flask

Close 505 Feb 11, 2021
NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.

NO LONGER MAINTAINED This repository is no longer maintained due to lack of time. You might check out the fork https://github.com/mrevutskyi/flask-res

null 1k Jan 4, 2023
NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.

NO LONGER MAINTAINED This repository is no longer maintained due to lack of time. You might check out the fork https://github.com/mrevutskyi/flask-res

null 1k Jan 15, 2021
Pyrin is an application framework built on top of Flask micro-framework to make life easier for developers who want to develop an enterprise application using Flask

Pyrin A rich, fast, performant and easy to use application framework to build apps using Flask on top of it. Pyrin is an application framework built o

Mohamad Nobakht 10 Jan 25, 2022
Daniel Vaz Gaspar 4k Jan 8, 2023
Fully featured framework for fast, easy and documented API development with Flask

Flask RestPlus IMPORTANT NOTICE: This project has been forked to Flask-RESTX and will be maintained by by the python-restx organization. Flask-RESTPlu

Axel H. 2.7k Jan 4, 2023
Fully featured framework for fast, easy and documented API development with Flask

Flask RestPlus IMPORTANT NOTICE: This project has been forked to Flask-RESTX and will be maintained by by the python-restx organization. Flask-RESTPlu

Axel H. 2.5k Feb 17, 2021
A boilerplate Flask API for a Fullstack Project with some additional packages and configuration prebuilt. ⚙

Flask Boilerplate to quickly get started with production grade flask application with some additional packages and configuration prebuilt.

Yasser Tahiri 32 Dec 24, 2022
Lemon is an async and lightweight API framework for python

Lemon is an async and lightweight API framework for python . Inspired by Koa and Sanic .

Joway 29 Nov 20, 2022
Endpoints is a lightweight REST api framework written in python and used in multiple production systems that handle millions of requests daily.

Endpoints Quickest API builder in the West! Endpoints is a lightweight REST api framework written in python and used in multiple production systems th

Jay Marcyes 30 Mar 5, 2022
APIFlask is a lightweight Python web API framework based on Flask and marshmallow-code projects

APIFlask APIFlask is a lightweight Python web API framework based on Flask and marshmallow-code projects. It's easy to use, highly customizable, ORM/O

Grey Li 705 Jan 4, 2023
A minimal, extensible, fast and productive API framework for Python 3.

molten A minimal, extensible, fast and productive API framework for Python 3. Changelog: https://moltenframework.com/changelog.html Community: https:/

Bogdan Popa 980 Nov 28, 2022
REST API framework designed for human beings

Eve Eve is an open source Python REST API framework designed for human beings. It allows to effortlessly build and deploy highly customizable, fully f

eve 6.6k Jan 7, 2023
Python AsyncIO data API to manage billions of resources

Introduction Please read the detailed docs This is the working project of the next generation Guillotina server based on asyncio. Dependencies Python

Plone Foundation 183 Nov 15, 2022
🔥 Fire up your API with this flamethrower

?? Fire up your API. Documentation: https://flama.perdy.io Flama Flama aims to bring a layer on top of Starlette to provide an easy to learn and fast

José Antonio Perdiguero 216 Dec 26, 2022
REST API framework designed for human beings

Eve Eve is an open source Python REST API framework designed for human beings. It allows to effortlessly build and deploy highly customizable, fully f

eve 6.3k Feb 17, 2021
A Flask API REST to access words' definition

A Flask API to access words' definitions

Pablo Emídio S.S 9 Jul 22, 2022