Questions tagged [webob]

Any questions regarding WebOb and its usage in Python WSGI applications.

WebOb is a Python library that provides wrappers around the WSGI request environment, and an object to help create WSGI responses. The objects map much of the specified behavior of HTTP, including header parsing, content negotiation and correct handling of conditional and range requests.

This helps you create rich applications and valid middleware without knowing all the complexities of WSGI and HTTP.

Documentation: WebOb Read the Docs
Source Code: WebOb on Github
Issue Tracker: Github Issues

38 questions
2
votes
2 answers

Google App Engine: Python: WebOb: How to get POST data in JSON format?

I am building a web app on the Google App Engine platform, which uses webapp2, which uses WebOb. I would like to POST some data in JSON format, including nested arrays and dictionaries. E.g.: $.post('/addvendor', {'vendor': {'name': 'test',…
jayhendren
  • 4,286
  • 2
  • 35
  • 59
2
votes
2 answers

Parse POST data containing square brackets in Python?

I'm writing a python webapp (on Google AppEngine, using webob) that should process a form containing a list of addresses. To simplify, lets say the form contains these inputs:
Eran Kampf
  • 8,928
  • 8
  • 49
  • 47
2
votes
1 answer

Is Host header poisoning possible in such case?

Django team considers host header poisoning (CVE-2011-4139 and CVE-2012-4520) as a security issue that must be resolved at a framework level. Pyramid, for instance (that is, its underlying low-level request wrapper—webob) does not consider this as…
1
vote
1 answer

Why does creating a neo4j.GraphDatabase from within a Paste app cause a segfault?

The following code causes Java to segfault: import os.path import neo4j from paste import httpserver, fileapp import tempfile from webob.dec import wsgify from webob import Response, Request HOST = '127.0.0.1' PORT = 8080 class DebugApp(object): …
marmida
  • 41
  • 7
1
vote
1 answer

GAE Python 2.7, no _io module?

I can't import WebOb 1.1 with the Python 2.7 runtime, as WebOb imports io, io imports _io, which is blocked by the SDK. Is there a way to whitelist _io? It is obviously not supposed to be blacklisted.
Attila O.
  • 15,659
  • 11
  • 54
  • 84
1
vote
1 answer

Set an attribute on a request before it's handled

My App Engine application has a custom user model. This model is accessed frequently in the application code. I would like to simplify the code by injecting a model instance into each authenticated request before the request is handled (similar to…
snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
1
vote
1 answer

Fresh solr instance for every hudson test build

I'm building a test suite for a python site, powered by hudson. Currently, the workflow for a test run looks like: Pull down the latest version from the repository. Create a new mysql db and import schema file and some fixture data. Run tests,…
GDorn
  • 8,511
  • 6
  • 38
  • 37
1
vote
1 answer

Get full raw http request (complete with headers and body)

In a appengine project im trying to get the whole http request inside an webapp2.RequestHandler: class ConnectedHandler(webapp2.RequestHandler): def post(self): logging.info("Someone connected: " + self.request.get('from')) # How to…
fasmide
  • 149
  • 1
  • 11
1
vote
1 answer

How to send post variables in HttpRedirect or HttpFound in webob in python ?

I want to send some variable in post when i am doing redirecting in my application. Scenario is like this def redirect_with_post(): post_variable = "i am a post variable" return HttpRedirect(location="/confirm?id=23&user=user1") # Now i want to…
Deepak Verma
  • 653
  • 1
  • 10
  • 24
1
vote
1 answer

Can I pass dictionary in HttpRedirection or HttpFound in webob in python?

I am trying to pass a dictionary to HttpRedirect or HttpFound method so that I can use this dictionary at the redirected url. I am using route module for url connect and using cherrypy and webob for Https. I want to do like this return…
Deepak Verma
  • 653
  • 1
  • 10
  • 24
1
vote
1 answer

Return binary data by webob.Response

I`m trying to return binary in webob.Response but error happens file = open(filePath, 'rb') buffer = file.read() file.close() self._response.body = buffer Gives the traceback "F:\Program Files\Python32\python.exe"…
atomAltera
  • 1,702
  • 2
  • 19
  • 38
0
votes
2 answers

pyramid - threadlocal doesn't work inside Response's app_iter

With the following sample code: from webob import Response from paste.httpserver import serve def test_iter(): from pyramid import threadlocal yield 'current request: %s' % threadlocal.get_current_request() def hello_world(request): …
sayap
  • 6,169
  • 2
  • 36
  • 40
0
votes
1 answer

After referencing an element in a WebOb.params (UnicodeMultiDict) an element gets popped off the end

When I reference the params parameter of the WebOb Request an element is suddenly popped off the end. That or it's being reduced to a single element. The referenced element isn't the one getting knocked off. if req.str_params.has_key('method'): …
Matt
  • 1,062
  • 11
  • 21
0
votes
1 answer

Using webapp2, how can I get the value of a form's "name" attribute during a POST request?

Code:
I would like to inform my application to what type of form is being submitted by a user. I thought I could use the form's "name" attribute but…
npk
  • 13
  • 4
0
votes
1 answer

Google App Engine Python WebApp framework supported self.error() codes

I know we can return errors to requests by calling self.error(http_error_code_here). However, there are some error codes that don't seem to be supported. "Unsupported error code" comes out when I use error code 510. I used…
Albert
  • 3,611
  • 3
  • 28
  • 52