8 Réponses
+ 17
"""
If the question was about how to handle web server with Python (instead of common Php), yes you need 'third party' module/framework such as Django, Flask or Bottle...
The code will look like:
"""
from bottle import route, run
@route('/hello')
def hello():
return "Hello World!"
run(host='localhost', port=8080, debug=True)
# Bottle basic code for handle response to web request: other frameworks would use same principle of decorators function ^^
+ 11
Yes: the code example provided is very basic and use a fixed url route, but you can build very complex 'filter', getting parameters inside and so on: all the stuff to build a complete web serving service ;)
Take a look at: http://pythonanywhere.com
They provide host in Python, with a wide choice of framework to use/install ^^
+ 4
respond to requests as in import requests?
u can use requests module btw pip install requests
like requests.get("https://www.sololearn.com")
then continue your script
+ 2
how about REST endpoints?
- 3
Thanks, I have received good answers here.
- 4
There are also filters to handle requests?
- 6
Did you think that it was a good discussion? Vote it up! Thanks
- 6
نعم