{"action":"opened","number":860,"pull_request":{"url":"https://api.github.com/repos/bottlepy/bottle/pulls/860","id":75845298,"html_url":"https://github.com/bottlepy/bottle/pull/860","diff_url":"https://github.com/bottlepy/bottle/pull/860.diff","patch_url":"https://github.com/bottlepy/bottle/pull/860.patch","issue_url":"https://api.github.com/repos/bottlepy/bottle/issues/860","number":860,"state":"open","locked":false,"title":"Example behaves as a synchronous server","user":{"login":"kianxineki","id":3725538,"avatar_url":"https://avatars.githubusercontent.com/u/3725538?v=3","gravatar_id":"","url":"https://api.github.com/users/kianxineki","html_url":"https://github.com/kianxineki","followers_url":"https://api.github.com/users/kianxineki/followers","following_url":"https://api.github.com/users/kianxineki/following{/other_user}","gists_url":"https://api.github.com/users/kianxineki/gists{/gist_id}","starred_url":"https://api.github.com/users/kianxineki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kianxineki/subscriptions","organizations_url":"https://api.github.com/users/kianxineki/orgs","repos_url":"https://api.github.com/users/kianxineki/repos","events_url":"https://api.github.com/users/kianxineki/events{/privacy}","received_events_url":"https://api.github.com/users/kianxineki/received_events","type":"User","site_admin":false},"body":"monkey.patch_all () without this line the server responds to requests synchronously\r\n\r\n``` python\r\nfrom bottle import request, Bottle, abort\r\nfrom gevent import monkey\r\nimport time\r\n\r\nmonkey.patch_all()\r\napp = Bottle()\r\n\r\n\r\n@app.get(\"/example\")\r\ndef example():\r\n    print(\"init\")\r\n    time.sleep(2)\r\n    print(\"end\")\r\n\r\n\r\n@app.route('/websocket')\r\ndef handle_websocket():\r\n    wsock = request.environ.get('wsgi.websocket')\r\n    if not wsock:\r\n        abort(400, 'Expected WebSocket request.')\r\n\r\n    while True:\r\n        try:\r\n            message = wsock.receive()\r\n            wsock.send(\"Your message was: %r\" % message)\r\n        except WebSocketError:\r\n            break\r\n\r\nif __name__ == \"__main__\":\r\n    from gevent.pywsgi import WSGIServer\r\n    from geventwebsocket import WebSocketError\r\n    from geventwebsocket.handler import WebSocketHandler\r\n    server = WSGIServer((\"0.0.0.0\", 9876), app,\r\n                        handler_class=WebSocketHandler)\r\n    server.serve_forever()\r\n\r\n```\r\n\r\n```\r\ninit\r\ninit\r\ninit\r\ninit\r\nend\r\nend\r\nend\r\nend\r\n```\r\n\r\n``` python\r\nfrom bottle import request, Bottle, abort\r\nfrom gevent import monkey\r\nimport time\r\n\r\nmonkey.patch_all()\r\napp = Bottle()\r\n\r\n\r\n@app.get(\"/example\")\r\ndef example():\r\n    print(\"init\")\r\n    time.sleep(2)\r\n    print(\"end\")\r\n\r\n\r\n@app.route('/websocket')\r\ndef handle_websocket():\r\n    wsock = request.environ.get('wsgi.websocket')\r\n    if not wsock:\r\n        abort(400, 'Expected WebSocket request.')\r\n\r\n    while True:\r\n        try:\r\n            message = wsock.receive()\r\n            wsock.send(\"Your message was: %r\" % message)\r\n        except WebSocketError:\r\n            break\r\n\r\nif __name__ == \"__main__\":\r\n    from gevent.pywsgi import WSGIServer\r\n    from geventwebsocket import WebSocketError\r\n    from geventwebsocket.handler import WebSocketHandler\r\n    server = WSGIServer((\"0.0.0.0\", 9876), app,\r\n                        handler_class=WebSocketHandler)\r\n    server.serve_forever()\r\n\r\n```\r\n\r\n```\r\ninit\r\nend\r\ninit\r\nend\r\ninit\r\nend\r\ninit\r\nend\r\n```","created_at":"2016-06-30T15:56:11Z","updated_at":"2016-06-30T15:56:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bottlepy/bottle/pulls/860/commits","review_comments_url":"https://api.github.com/repos/bottlepy/bottle/pulls/860/comments","review_comment_url":"https://api.github.com/repos/bottlepy/bottle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bottlepy/bottle/issues/860/comments","statuses_url":"https://api.github.com/repos/bottlepy/bottle/statuses/63170efe4fae6b589407df0af149bf310869f4b8","head":{"label":"kianxineki:patch-2","ref":"patch-2","sha":"63170efe4fae6b589407df0af149bf310869f4b8","user":{"login":"kianxineki","id":3725538,"avatar_url":"https://avatars.githubusercontent.com/u/3725538?v=3","gravatar_id":"","url":"https://api.github.com/users/kianxineki","html_url":"https://github.com/kianxineki","followers_url":"https://api.github.com/users/kianxineki/followers","following_url":"https://api.github.com/users/kianxineki/following{/other_user}","gists_url":"https://api.github.com/users/kianxineki/gists{/gist_id}","starred_url":"https://api.github.com/users/kianxineki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kianxineki/subscriptions","organizations_url":"https://api.github.com/users/kianxineki/orgs","repos_url":"https://api.github.com/users/kianxineki/repos","events_url":"https://api.github.com/users/kianxineki/events{/privacy}","received_events_url":"https://api.github.com/users/kianxineki/received_events","type":"User","site_admin":false},"repo":{"id":62317323,"name":"bottle","full_name":"kianxineki/bottle","owner":{"login":"kianxineki","id":3725538,"avatar_url":"https://avatars.githubusercontent.com/u/3725538?v=3","gravatar_id":"","url":"https://api.github.com/users/kianxineki","html_url":"https://github.com/kianxineki","followers_url":"https://api.github.com/users/kianxineki/followers","following_url":"https://api.github.com/users/kianxineki/following{/other_user}","gists_url":"https://api.github.com/users/kianxineki/gists{/gist_id}","starred_url":"https://api.github.com/users/kianxineki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kianxineki/subscriptions","organizations_url":"https://api.github.com/users/kianxineki/orgs","repos_url":"https://api.github.com/users/kianxineki/repos","events_url":"https://api.github.com/users/kianxineki/events{/privacy}","received_events_url":"https://api.github.com/users/kianxineki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kianxineki/bottle","description":"bottle.py is a fast and simple micro-framework for python web-applications.","fork":true,"url":"https://api.github.com/repos/kianxineki/bottle","forks_url":"https://api.github.com/repos/kianxineki/bottle/forks","keys_url":"https://api.github.com/repos/kianxineki/bottle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kianxineki/bottle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kianxineki/bottle/teams","hooks_url":"https://api.github.com/repos/kianxineki/bottle/hooks","issue_events_url":"https://api.github.com/repos/kianxineki/bottle/issues/events{/number}","events_url":"https://api.github.com/repos/kianxineki/bottle/events","assignees_url":"https://api.github.com/repos/kianxineki/bottle/assignees{/user}","branches_url":"https://api.github.com/repos/kianxineki/bottle/branches{/branch}","tags_url":"https://api.github.com/repos/kianxineki/bottle/tags","blobs_url":"https://api.github.com/repos/kianxineki/bottle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kianxineki/bottle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kianxineki/bottle/git/refs{/sha}","trees_url":"https://api.github.com/repos/kianxineki/bottle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kianxineki/bottle/statuses/{sha}","languages_url":"https://api.github.com/repos/kianxineki/bottle/languages","stargazers_url":"https://api.github.com/repos/kianxineki/bottle/stargazers","contributors_url":"https://api.github.com/repos/kianxineki/bottle/contributors","subscribers_url":"https://api.github.com/repos/kianxineki/bottle/subscribers","subscription_url":"https://api.github.com/repos/kianxineki/bottle/subscription","commits_url":"https://api.github.com/repos/kianxineki/bottle/commits{/sha}","git_commits_url":"https://api.github.com/repos/kianxineki/bottle/git/commits{/sha}","comments_url":"https://api.github.com/repos/kianxineki/bottle/comments{/number}","issue_comment_url":"https://api.github.com/repos/kianxineki/bottle/issues/comments{/number}","contents_url":"https://api.github.com/repos/kianxineki/bottle/contents/{+path}","compare_url":"https://api.github.com/repos/kianxineki/bottle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kianxineki/bottle/merges","archive_url":"https://api.github.com/repos/kianxineki/bottle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kianxineki/bottle/downloads","issues_url":"https://api.github.com/repos/kianxineki/bottle/issues{/number}","pulls_url":"https://api.github.com/repos/kianxineki/bottle/pulls{/number}","milestones_url":"https://api.github.com/repos/kianxineki/bottle/milestones{/number}","notifications_url":"https://api.github.com/repos/kianxineki/bottle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kianxineki/bottle/labels{/name}","releases_url":"https://api.github.com/repos/kianxineki/bottle/releases{/id}","deployments_url":"https://api.github.com/repos/kianxineki/bottle/deployments","created_at":"2016-06-30T14:30:43Z","updated_at":"2016-06-30T14:30:44Z","pushed_at":"2016-06-30T15:55:58Z","git_url":"git://github.com/kianxineki/bottle.git","ssh_url":"git@github.com:kianxineki/bottle.git","clone_url":"https://github.com/kianxineki/bottle.git","svn_url":"https://github.com/kianxineki/bottle","homepage":"http://bottlepy.org/","size":7712,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bottlepy:master","ref":"master","sha":"fbf641da04bc2c7abec08792c2a3b73bd31d87d7","user":{"login":"bottlepy","id":1019799,"avatar_url":"https://avatars.githubusercontent.com/u/1019799?v=3","gravatar_id":"","url":"https://api.github.com/users/bottlepy","html_url":"https://github.com/bottlepy","followers_url":"https://api.github.com/users/bottlepy/followers","following_url":"https://api.github.com/users/bottlepy/following{/other_user}","gists_url":"https://api.github.com/users/bottlepy/gists{/gist_id}","starred_url":"https://api.github.com/users/bottlepy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bottlepy/subscriptions","organizations_url":"https://api.github.com/users/bottlepy/orgs","repos_url":"https://api.github.com/users/bottlepy/repos","events_url":"https://api.github.com/users/bottlepy/events{/privacy}","received_events_url":"https://api.github.com/users/bottlepy/received_events","type":"Organization","site_admin":false},"repo":{"id":239940,"name":"bottle","full_name":"bottlepy/bottle","owner":{"login":"bottlepy","id":1019799,"avatar_url":"https://avatars.githubusercontent.com/u/1019799?v=3","gravatar_id":"","url":"https://api.github.com/users/bottlepy","html_url":"https://github.com/bottlepy","followers_url":"https://api.github.com/users/bottlepy/followers","following_url":"https://api.github.com/users/bottlepy/following{/other_user}","gists_url":"https://api.github.com/users/bottlepy/gists{/gist_id}","starred_url":"https://api.github.com/users/bottlepy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bottlepy/subscriptions","organizations_url":"https://api.github.com/users/bottlepy/orgs","repos_url":"https://api.github.com/users/bottlepy/repos","events_url":"https://api.github.com/users/bottlepy/events{/privacy}","received_events_url":"https://api.github.com/users/bottlepy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bottlepy/bottle","description":"bottle.py is a fast and simple micro-framework for python web-applications.","fork":false,"url":"https://api.github.com/repos/bottlepy/bottle","forks_url":"https://api.github.com/repos/bottlepy/bottle/forks","keys_url":"https://api.github.com/repos/bottlepy/bottle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bottlepy/bottle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bottlepy/bottle/teams","hooks_url":"https://api.github.com/repos/bottlepy/bottle/hooks","issue_events_url":"https://api.github.com/repos/bottlepy/bottle/issues/events{/number}","events_url":"https://api.github.com/repos/bottlepy/bottle/events","assignees_url":"https://api.github.com/repos/bottlepy/bottle/assignees{/user}","branches_url":"https://api.github.com/repos/bottlepy/bottle/branches{/branch}","tags_url":"https://api.github.com/repos/bottlepy/bottle/tags","blobs_url":"https://api.github.com/repos/bottlepy/bottle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bottlepy/bottle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bottlepy/bottle/git/refs{/sha}","trees_url":"https://api.github.com/repos/bottlepy/bottle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bottlepy/bottle/statuses/{sha}","languages_url":"https://api.github.com/repos/bottlepy/bottle/languages","stargazers_url":"https://api.github.com/repos/bottlepy/bottle/stargazers","contributors_url":"https://api.github.com/repos/bottlepy/bottle/contributors","subscribers_url":"https://api.github.com/repos/bottlepy/bottle/subscribers","subscription_url":"https://api.github.com/repos/bottlepy/bottle/subscription","commits_url":"https://api.github.com/repos/bottlepy/bottle/commits{/sha}","git_commits_url":"https://api.github.com/repos/bottlepy/bottle/git/commits{/sha}","comments_url":"https://api.github.com/repos/bottlepy/bottle/comments{/number}","issue_comment_url":"https://api.github.com/repos/bottlepy/bottle/issues/comments{/number}","contents_url":"https://api.github.com/repos/bottlepy/bottle/contents/{+path}","compare_url":"https://api.github.com/repos/bottlepy/bottle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bottlepy/bottle/merges","archive_url":"https://api.github.com/repos/bottlepy/bottle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bottlepy/bottle/downloads","issues_url":"https://api.github.com/repos/bottlepy/bottle/issues{/number}","pulls_url":"https://api.github.com/repos/bottlepy/bottle/pulls{/number}","milestones_url":"https://api.github.com/repos/bottlepy/bottle/milestones{/number}","notifications_url":"https://api.github.com/repos/bottlepy/bottle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bottlepy/bottle/labels{/name}","releases_url":"https://api.github.com/repos/bottlepy/bottle/releases{/id}","deployments_url":"https://api.github.com/repos/bottlepy/bottle/deployments","created_at":"2009-06-30T17:51:30Z","updated_at":"2016-06-30T14:55:57Z","pushed_at":"2016-06-19T15:33:30Z","git_url":"git://github.com/bottlepy/bottle.git","ssh_url":"git@github.com:bottlepy/bottle.git","clone_url":"https://github.com/bottlepy/bottle.git","svn_url":"https://github.com/bottlepy/bottle","homepage":"http://bottlepy.org/","size":7712,"stargazers_count":3805,"watchers_count":3805,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":767,"mirror_url":null,"open_issues_count":214,"forks":767,"open_issues":214,"watchers":3805,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bottlepy/bottle/pulls/860"},"html":{"href":"https://github.com/bottlepy/bottle/pull/860"},"issue":{"href":"https://api.github.com/repos/bottlepy/bottle/issues/860"},"comments":{"href":"https://api.github.com/repos/bottlepy/bottle/issues/860/comments"},"review_comments":{"href":"https://api.github.com/repos/bottlepy/bottle/pulls/860/comments"},"review_comment":{"href":"https://api.github.com/repos/bottlepy/bottle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bottlepy/bottle/pulls/860/commits"},"statuses":{"href":"https://api.github.com/repos/bottlepy/bottle/statuses/63170efe4fae6b589407df0af149bf310869f4b8"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":3,"deletions":0,"changed_files":1}}
{"actor":{"display_login":"kianxineki"}}