Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

shutdown flask server with request

from flask import request

def shutdown_server():
    func = request.environ.get('werkzeug.server.shutdown')
    if func is None:
        raise RuntimeError('Not running with the Werkzeug Server')
    func()

@app.route('/shutdown', methods=['POST'])
def shutdown():
    shutdown_server()
    return 'Server shutting down...'
Comment

PREVIOUS NEXT
Code Example
Python :: how to fill nan values in pandas 
Python :: ejercicios con funciones en python 
Python :: select a random element from a list python 
Python :: pandas create column if equals 
Python :: how to add an item to a dictionary in python 
Python :: How to do train test split in keras Imagedatagenerator 
Python :: python mean 
Python :: python how to get user input 
Python :: NumPy unique Example Get the counts of each unique value 
Python :: check if two strings are anagrams python 
Python :: add a value to an existing field in pandas dataframe after checking conditions 
Python :: lowercase all text in a column 
Python :: multiple pdf to csv python 
Python :: count dictionary keys 
Python :: how to find the position in a list python 
Python :: how to retrieve dictionary values in python by index 
Python :: reportlab python draw line 
Python :: print all attributes of object python 
Python :: python max key dictionary key getter 
Python :: create a blank image opencv 
Python :: click ok on alert box selenium webdriver python 
Python :: drawing arrows in tkinter 
Python :: python - remove floating in a dataframe 
Python :: selenium firefox webdriver 
Python :: how to split a string by character in python 
Python :: flask client ip 
Python :: take screenshot of video python 
Python :: python move a file from one folder to another 
Python :: discord py import commands 
Python :: how to get random number python 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =