web.py

Force Nosetests to Use Python 2.7 instead of 3.4

你。 提交于 2019-12-22 05:17:50
问题 I've been learning Python using version 3.4. I recently started learning Web.py so have been using Python 2.7 for that, since web.py not supported in Python 3.4. I have nose 1.3.4 module installed for both Python 3.4 and 2.7. I need to run the nosetests command on some Python code written in 2.7 that uses the Web.py module. However, when I type nosetests command it automatically uses Python 3.4, so is throwing an error as unable to import the Web.py module in my Python code. Is there a way to

python apscheduler not consistent

≡放荡痞女 提交于 2019-12-21 21:09:14
问题 I'm running a scheduler using python apscheduler inside web.py framework. The function runserver is supposed to run everyday at 9 a.m but it is inconsistent. It runs most days but skips a day once in a while. Code: import web from apscheduler.schedulers.blocking import BlockingScheduler #Blocking Scheduler #URLs urls = ( '/startscheduler/','index', ) Nightlysched = BlockingScheduler() @Nightlysched.scheduled_job('cron', hour=9) def runserver(): print 2+2 #doing some calculations here #Main

How to convert a string data to a JSON object in python?

丶灬走出姿态 提交于 2019-12-21 12:24:48
问题 Here is the sample string i am receiving from one of the web services, body=%7B%22type%22%3A%22change%22%2C%22url%22%3A%22http%3A%2F%2Fapi.pachube.com%2Fv2%2Ftriggers%2F4100%22%2C%22environment%22%3A%7B%22feed%22%3A%22http%3A%2F%2Fapi.pachube.com%2Fv2%2Ffeeds%2F36133%22%2C%22title%22%3A%22Current+Cost+Bridge%22%2C%22description%22%3Anull%2C%22id%22%3A36133%7D%2C%22threshold_value%22%3Anull%2C%22timestamp%22%3A%222012-01-05T09%3A27%3A01Z%22%2C%22triggering_datastream%22%3A%7B%22url%22%3A

web.py: how to get POST parameter and GET parameter?

守給你的承諾、 提交于 2019-12-21 09:11:48
问题 I'm new to web.py . I used PHP alot. In PHP, POST parameter and GET parameter is stored in different global variables For example: curl http://127.0.0.1/test?get_param1=1 -d 'post_param1=2' In PHP you can get $_GET['get_param1'] is 1 and $_POST['post_param1'] is 2. But it seems impossible to distinct GET/POST parameters in web.py ? I can only use web.input() to get GET/POST parameters in a dict-like object, but I cannot tell which of them is from the query string and which is from POST data

Differences between webapp and web.py

╄→尐↘猪︶ㄣ 提交于 2019-12-20 09:47:19
问题 Webpy.org - Who uses web.py? "[web.py inspired the] web framework we use at FriendFeed [and] the webapp framework that ships with App Engine..." — Brett Taylor, co-founder of FriendFeed and original tech lead on Google App Engine Google App Engine Getting Started for Python HTML embedded in code is messy and difficult to maintain. It's better to use a templating system... ...For your convenience, the webapp module includes Django's templating engine Questions: What are the differences between

Downloading/exporting a csv file when clicked on a button in web.py python

匆匆过客 提交于 2019-12-19 11:48:13
问题 I am using python web.py framework to build a small web app. It consists of a Home page that takes a url as input Reads anchor text and anchor tags from it Writes it to csv file and downloads it Here the steps 2 and 3 happens when we clicked on a export the links button, below is my code code.py import web from web import form import urlparse from urlparse import urlparse as ue import urllib2 from BeautifulSoup import BeautifulSoup import csv from cStringIO import StringIO urls = ( '/',

Content-Length is being stripped

南楼画角 提交于 2019-12-19 04:13:14
问题 I'm using webpy 0.34, python 2.6.6. I'm also using mimerender. I am trying to include the content-length in my http response, but for some reason the header is being removed. I say removed because I can create custom headers just fine, and I can see those headers on the client. But when I try to set content-length, the header never makes it to the client. I've tried including the header in the web.created object (as shown) and I've also tried using web.header('Content-Length', len(data)) What

Why do I get a KeyError?

邮差的信 提交于 2019-12-13 20:53:20
问题 This is my code: import web import json urls = ( '/', 'index' '/runs', 'runs' ) app = web.application(urls, globals()) class index: def GET(self): render = web.template.render('templates/') return render.index() class runs: def GET(self): return "Test" if __name__ == "__main__": app.run() And I get the following error: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 239, in process return self.handle() File "/usr/local/lib/python2.7

python web.py web service multiple parameters query not working

半城伤御伤魂 提交于 2019-12-13 07:42:55
问题 I did a web service using web.py install web.py cd webpy edit python web service. #!/usr/bin/env python urls = ('/title_matching2','title_matching2') app = web.application(urls,globals()) class title_matching2: def __init__(self): self.hello = "hello world" def GET(self): getInput = web.input(name="World") processing the data, return the hash table, I wanted return gg if __name__ == "__main__": app.run() Then I run this web service , ./some.py, and then call: links http://localhost:8080/title

Files being served are stale / cached ; Python as fcgi + web.py + nginx

人盡茶涼 提交于 2019-12-13 06:19:20
问题 I'm serving files in ubuntu using Nginx and fcgi, python and web.py. My index.py contents are: app = web.application(urls, globals(), True) if __name__ == "__main__": web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr) app.run() And I'm launching with: spawn-fcgi -n -d /usr/share/nginx/www -f ~/Projects/index.py -a 127.0.0.1 -p 9002 Which works fine, EXCEPT, once I make changes to the source files (index.py or any class it includes), those new files are never loaded. I