Skip to content

Instantly share code, notes, and snippets.

@suoto
Created April 13, 2016 16:37
Show Gist options
  • Save suoto/2c3e9fe51b38208dfddd4144c0ae80cb to your computer and use it in GitHub Desktop.
Save suoto/2c3e9fe51b38208dfddd4144c0ae80cb to your computer and use it in GitHub Desktop.
This apparently reproduces issue described at https://github.com/kennethreitz/requests/issues/2887
#!/usr/bin/env python
"""
This apparently reproduces issue described at
https://github.com/kennethreitz/requests/issues/2887
Versions:
- Requests version: 2.9.1
- Bottle version: 0.12.9
- Waitress version: 0.8.10
"""
import bottle
import requests
import time
@bottle.post('/foobar')
def index():
print "Called foobar"
from multiprocessing import Process as Process
def getServer():
kwargs = {'host' : 'localhost',
'port' : '50000',
'server' : 'waitress'}
proc = Process(target=bottle.run, kwargs=kwargs)
return proc
def main():
proc = getServer()
proc.start()
requests.post('http://localhost:50000/foobar')
time.sleep(1)
proc.terminate()
proc.join()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment