Skip to main content

A small pypi project, that allows you to make your own API.

Project description

makeapi

A small package, that allows you to make an API.

Example

import makeapi

request_handler = makeapi.MakeAPIRequest
app = MakeAPI("localhost", 8000, request_handler) # localhost is your local computer

# Currently, it only has get request method.

@app.get("/main")
def main(request : makeapi.Request):
    return makeapi.textresp("Hello!")
    
app.run()    

# Go to http://localhost:8000/main in your browser and you should see Hello!

Example with path params

import makeapi

request_handler = MakeAPIRequest
app = MakeAPI("localhost", 8000, request_handler)

# you can only have 1 parameter.

@app.get("/params")
def params_route(request : makeapi.Request):
    params = request.args
    return jsonresp(params)    

app.run()

# Go to http://localhost:8000/params?hello=hi and it should show {"hello": "hi"}

Enjoy!

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

makeapi-1.0.4.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

makeapi-1.0.4-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

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