cherrypy

cherrypy /dev/urandom (or equivalent) not found — error

北慕城南 提交于 2020-01-03 13:51:02
问题 I am running a cherrypy 3.2.0 server with Python 2.5.1, which gives the following error every few days on any instruction from UI until it is killed and re-started:- [29/Mar/2012:06:37:57] HTTP Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/CherryPy-3.2.0-py2.5.egg/cherrypy/_cprequest.py", line 636, in respond File "/usr/lib/python2.5/site-packages/CherryPy-3.2.0-py2.5.egg/cherrypy/_cprequest.py", line 97, in run File "/usr/lib/python2.5/site-packages/CherryPy-3.2.0

CherryPy: How to process a request before it has reached the application method? [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 03:04:24
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I want to be able to catch the arguments of the methods of my CherryPy application before the method itself. But I'm not sure if there is a way to do it in CherryPy or with standard python. It should look something like this: HTTP Request --> Parser to catch the arguments -->

ImportError: No module named http.cookies error when installing cherrypy 3.2

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 23:15:31
问题 I am having trouble installing cherrypy 3.2 on Linux machines (both on Ubuntu and Centos). I have the latest Python and Pip (version 2.7) installed on the machines. On Ubuntu, I am using $sudo pip install cherrypy. On centos, I was installing from source. After install finished and succeeded, when importing cherrypy module, I get the error: >>> import cherrypy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/site-packages/cherrypy/__init__

How to disable SSL3 and weak ciphers with cherrypy builtin ssl module (python 3)

╄→尐↘猪︶ㄣ 提交于 2020-01-02 03:51:07
问题 I have configured Cherrypy 3.8.0 with Python 3 to use SSL/TLS. However, I want to disable SSL3 to avoid POODLE. I searched through the documentation but I am unsure on how to implement it. I am using the cherrypy/python builtin ssl module, not pyOpenSSL which I am unable to use under Python 3. 回答1: To disable SSL3, you should set the ssl_context variable yourself rather than accepting the default. Here's an example using Python's built-in ssl module (in lieu of the built-in cherrypy ssl

How to execute asynchronous post-processing in CherryPy?

久未见 提交于 2020-01-01 03:21:11
问题 Context: Imagine that you have a standard CherryPy hello word app: def index(self): return "Hello world!" index.exposed = True and you would like to do some post-processing, i.e. record request processing or just log the fact that we were called from specific IP. What you would do is probably: def index(self): self.RunMyPostProcessing() return "Hello world!" index.exposed = True However, that will add to your request processing time. (btw. And probably you will use decorators, or even some

Using CherryPy/Cherryd to launch multiple Flask instances

余生长醉 提交于 2020-01-01 02:34:11
问题 Per suggestions on SO/SF and other sites, I am using CherryPy as the WSGI server to launch multiple instances of a Python web server I built with Flask. Each instance runs on its own port and sits behind Nginx. I should note that the below does work for me, but I'm troubled that I have gone about things the wrong way and it works "by accident". Here is my current cherrypy.conf file: [global] server.socket_host = '0.0.0.0' server.socket_port = 8891 request.dispatch: cherrypy.dispatch

How do you use cookies and HTTP Basic Authentication in CherryPy?

江枫思渺然 提交于 2019-12-31 10:55:00
问题 I have a CherryPy web application that requires authentication. I have working HTTP Basic Authentication with a configuration that looks like this: app_config = { '/' : { 'tools.sessions.on': True, 'tools.sessions.name': 'zknsrv', 'tools.auth_basic.on': True, 'tools.auth_basic.realm': 'zknsrv', 'tools.auth_basic.checkpassword': checkpassword, } } HTTP auth works great at this point. For example, this will give me the successful login message that I defined inside AuthTest : curl http:/

CherryPy Custom Tool for user authentication

柔情痞子 提交于 2019-12-30 23:36:24
问题 I'm trying to set up a simple way of decorating methods in my CherryPy controller classes so that a user is redirected to the login page if they haven't authenticated yet. I was going to do a basic Python decorator, but an answer here suggested I use a CherryPy Custom Tool instead. So I'm trying to do that, but I can't get it to work. Here's what I have: def authenticate(): user = cherrypy.session.get('user', None) if not user: raise cherrypy.HTTPRedirect('/?errMsg=Please%20log%20in%20first')

CherryPy Custom Tool for user authentication

风流意气都作罢 提交于 2019-12-30 23:36:11
问题 I'm trying to set up a simple way of decorating methods in my CherryPy controller classes so that a user is redirected to the login page if they haven't authenticated yet. I was going to do a basic Python decorator, but an answer here suggested I use a CherryPy Custom Tool instead. So I'm trying to do that, but I can't get it to work. Here's what I have: def authenticate(): user = cherrypy.session.get('user', None) if not user: raise cherrypy.HTTPRedirect('/?errMsg=Please%20log%20in%20first')

How to use cherrypy as a web server for static files?

孤街醉人 提交于 2019-12-29 03:29:06
问题 Is it any easy way to use CherryPy as an web server that will display .html files in some folder? All CherryPy introductory documentation states that content is dynamically generated: import cherrypy class HelloWorld(object): def index(self): return "Hello World!" index.exposed = True cherrypy.quickstart(HelloWorld()) Is it any easy way to use index.html instead of HelloWorld.index() method? 回答1: This simple code will serve files on current directory. import os import cherrypy PATH = os.path