Skip to main content

Bottle.py wrapper to make python objects accessible via HTTP API

Project description

Nimrodel

A simple Bottle.py-wrapper to provide HTTP API access to any python object.

Requirements

Quick Start

Install with

pip install nimrodel

Create your API with

from nimrodel import API

myapi = API()

You can pass a port number with port=42, a path with path="api" and whether you want to serve on IPv4 (IPv6=False). You can also give the API object an existing bottle server (server=bottleobject), in which case your API will be served on the existing server. In this case, it is heavily recommended to pass a path variable to separate API from regular routing of your server.

Then make any class accessible with a decorator.

@myapi.apiclass("group")
class Group:

	def __init__(self,name,apipath,songs):
		# some stuff
		self.__apiname__ = apipath

Any instance of that class is now accessible via the combination of class path and its individual path. Now just decorate the methods. All its arguments can be passed via URI query arguments.

	@myapi.get("songs")
	def get_songs(self,member):
		return {"songs":[s["title"] for s in self.songs if member in s["performers"]]}

Now create an object and make sure it has an __apiname__ attribute:

e = Group("Exid","exid",exidsongs)

Then you can access its methods with simple HTTP calls:

HTTP GET http://localhost:1337/group/exid/songs?member=Junghwa

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nimrodel-0.2.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

nimrodel-0.2.3-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file nimrodel-0.2.3.tar.gz.

File metadata

  • Download URL: nimrodel-0.2.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for nimrodel-0.2.3.tar.gz
Algorithm Hash digest
SHA256 677794de66cde4faab1f81e65d6ed0642e8af1f1094a726a0ce6a3ddf28e74cb
MD5 08730d639b7f2b0ef1fbdaf8d673b3d0
BLAKE2b-256 bd3eaa807077c5b5f8eb3f00f59b8d289f493125bdc0297c8ec2512888ee0363

See more details on using hashes here.

File details

Details for the file nimrodel-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: nimrodel-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for nimrodel-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f29e33fef17b26e196be3f2d5e848f5274e0616a369066df58beb0ccc0cdf837
MD5 ee6a2aa5c4453df7c52ac29800e7667a
BLAKE2b-256 63898b086ddd913b342c9196da09492753042d8854e647119322d2b5292a6f6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page