开发者

How to write "Hello World" RESTful API using Python and then consume it

I am totally new to Python. Can anybody guide me how to write开发者_如何学Go and then consume a simple "Hello World" RESTful API in Python.


I recommend using a WSGI “microframework” such as Bottle or web.py.

Here's hello world with Bottle, taken directly from its home page:

from bottle import route, run

@route('/:name')
def index(name='World'):
    return '<b>Hello %s!</b>' % name

run(host='localhost', port=8080)


In general, I would refer you to the excellent book RESTful Web Services. It can get you started in REST with some Python examples. Also, you might want to consider writing some simpler Python code to increase your comfort level first. Welcome to Python - I hope it serves you as well as it has me!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜