I am trying to integrate a webcamera with a site and I can get it to POST the data to a certain url on the server the problem is I can't figure out how to get access to the data. It is not in REQUEST.form the relevant request vars are ('CONTENT_LENGTH', '111695') ('CONTENT_TYPE', 'image/jpeg') ('HTTP_CONTENT_DISPOSITION', 'attachment; filename="image01-07-29_05-54-26-96.jpg"') This is being posted to a python script object inside zope, however if I need to use an external method that is not a problem I just need to figure out how to get the data. Thanks
William Heymann wrote:
I am trying to integrate a webcamera with a site and I can get it to POST the data to a certain url on the server the problem is I can't figure out how to get access to the data. It is not in REQUEST.form
the relevant request vars are
('CONTENT_LENGTH', '111695') ('CONTENT_TYPE', 'image/jpeg') ('HTTP_CONTENT_DISPOSITION', 'attachment; filename="image01-07-29_05-54-26-96.jpg"')
This is being posted to a python script object inside zope, however if I need to use an external method that is not a problem I just need to figure out how to get the data.
If the file is posted as attachment (similar to file upload) it should appear in the relevant form element as file. You can just use the method .read() on it to get the data (or feed it into factory of image/file) For this to work the data needs to be sent as enctype="multipart/form-data" (hopefully the cam does this). Maybe you send all variables of the request to figure out. Regards Tino
On Wednesday 09 July 2008, Tino Wildenhain wrote:
William Heymann wrote:
I am trying to integrate a webcamera with a site and I can get it to POST the data to a certain url on the server the problem is I can't figure out how to get access to the data. It is not in REQUEST.form
the relevant request vars are
('CONTENT_LENGTH', '111695') ('CONTENT_TYPE', 'image/jpeg') ('HTTP_CONTENT_DISPOSITION', 'attachment; filename="image01-07-29_05-54-26-96.jpg"')
This is being posted to a python script object inside zope, however if I need to use an external method that is not a problem I just need to figure out how to get the data.
If the file is posted as attachment (similar to file upload) it should appear in the relevant form element as file. You can just use the method .read() on it to get the data (or feed it into factory of image/file)
Unfortunately it is now showing up in REQUEST.form, it is not a POST like what you get with a file upload from a form. Zope is showing that the correct size of data was sent to that page.
For this to work the data needs to be sent as enctype="multipart/form-data" (hopefully the cam does this).
It was not sent with that kind of encoding at least not in any way I can tell. It was a webcam and all I could give it was a url to POST the data to and it did not submit it like a regular form.
Maybe you send all variables of the request to figure out.
Regards Tino
----- Original Message ----- From: "William Heymann" <kosh@aesaeion.com> To: <zope@zope.org> Sent: Wednesday, July 09, 2008 6:42 AM Subject: Re: [Zope] getting post data from a webcam
On Wednesday 09 July 2008, Tino Wildenhain wrote:
William Heymann wrote:
I am trying to integrate a webcamera with a site and I can get it to POST the data to a certain url on the server the problem is I can't figure out how to get access to the data. It is not in REQUEST.form
the relevant request vars are
('CONTENT_LENGTH', '111695') ('CONTENT_TYPE', 'image/jpeg') ('HTTP_CONTENT_DISPOSITION', 'attachment; filename="image01-07-29_05-54-26-96.jpg"')
This is being posted to a python script object inside zope, however if I need to use an external method that is not a problem I just need to figure out how to get the data.
If the file is posted as attachment (similar to file upload) it should appear in the relevant form element as file. You can just use the method .read() on it to get the data (or feed it into factory of image/file)
Unfortunately it is now showing up in REQUEST.form, it is not a POST like what you get with a file upload from a form. Zope is showing that the correct size of data was sent to that page.
For this to work the data needs to be sent as enctype="multipart/form-data" (hopefully the cam does this).
It was not sent with that kind of encoding at least not in any way I can tell. It was a webcam and all I could give it was a url to POST the data to and it did not submit it like a regular form.
Maybe you send all variables of the request to figure out.
Regards Tino
You need to provide more details... try dumping the contents of REQUEST and posting them as was suggested earlier. Jonathan
On Wednesday 09 July 2008, Jonathan wrote:
You need to provide more details... try dumping the contents of REQUEST and posting them as was suggested earlier.
I did post all the relevant fields from the REQUEST here are all of the them in REQUEST.items() [('ACTUAL_URL', 'http://www.XXXXXXXXX.com/imageuploader'), ('AUTHENTICATED_USER', <User 'XXXXX'>), ('AUTHENTICATION_PATH', 'XXX/VirtualHostBase//'), ('BASE0', 'http:// www.XXXXXXXXXXcom'), ('BASE1', 'http://www.cougarcanyonlivingXXXXXXXX.com'), ('BASE2', 'http://www.XXXXXXXX.com/imageuploader'), ('CONTENT_LENGTH', '111695'), ('CONTENT_TYPE', 'image/jpeg'), ('GATEWAY_INTERFACE', 'CGI/1.1'), ('HTTP_CONTENT_DISPOSITION', 'attachment; filename="image01-07-29_05-54-26-96.jpg"'), ('HTTP_HOST', '127.0.0.1:9673'), ('HTTP_MAX_FORWARDS', '10'), ('HTTP_USER_AGENT', 'Axis shttpclien t $Revision: 1.45 $'), ('HTTP_VIA', '1.0 www.XXXXXXXX.com'), ('HTTP_X_FORWARDED_FOR', 'XX.XXX.XXX.XXX'), ('HTTP_X_FORWARDED_HOST', 'XXXXXXXX.com'), ('HTTP_X_FORWARDED_SERVER', 'www.XXXXXXXXX.com'), ('PARENTS', [<Folder at /XXX>, <Application at >]), ('PATH_INFO', '/VirtualHostBase/http/www.XXXXXXXX.com:80/XXX/VirtualHostRoot/imageuploader'), ('PATH_TRANSLATED', '/VirtualHostBase /http/www.XXXXXXXX.com:80/XXX/VirtualHostRoot/imageuploader'), ('PUBLISHED', <PythonScript at /XXX/imageuploader>), ('REMOTE_ADDR', '127.0.0.1'), ('REQUEST_METHOD', 'POST'), ('RESPONSE', ZServerHTTPRe sponse('')), ('SCRIPT_NAME', ''), ('SERVER_NAME', 'localhost'), ('SERVER_PORT', '9673'), ('SERVER_PROTOCOL', 'HTTP/1.1'), ('SERVER_SOFTWARE', 'Zope/(Zope 2.9.6-final, python 2.4.4, linux2) ZServer/1.1'), ('SERVER_URL', 'http://www.XXXXXXXX.com'), ('SESSION', id: 12155753281337189705, token: 99836730A3cKJMzoaVU, content keys: []), ('TraversalRequestNameStack', []), ('URL', 'http://www.XXXXXXXX.com/ imageuploader'), ('URL0', 'http://www.XXXXXXXX.com/imageuploader'), ('URL1', 'http://www.XXXXXXXX.com'), ('VIRTUAL_URL', 'http://www.XXXXXXXX.com/imageuploader'), ('VIRTUAL_URL_PARTS', ('http://www.XXXXXXXX.com', 'imageuploader')), ('VirtualRootPhysicalPath', ('', 'XXX')), ('__aca', '/36gevRRS99FhE%2BrH6GVLeSzXzA%3D%0A'), ('traverse_subpath', [])] there is nothing in REQUEST.form
----- Original Message ----- From: "William Heymann" <kosh@aesaeion.com> To: <zope@zope.org> Sent: Wednesday, July 09, 2008 7:23 AM Subject: Re: [Zope] getting post data from a webcam
On Wednesday 09 July 2008, Jonathan wrote:
You need to provide more details... try dumping the contents of REQUEST and posting them as was suggested earlier.
I did post all the relevant fields from the REQUEST
here are all of the them in REQUEST.items()
[('ACTUAL_URL', 'http://www.XXXXXXXXX.com/imageuploader'), ('AUTHENTICATED_USER', <User 'XXXXX'>), ('AUTHENTICATION_PATH', 'XXX/VirtualHostBase//'), ('BASE0', 'http:// www.XXXXXXXXXXcom'), ('BASE1', 'http://www.cougarcanyonlivingXXXXXXXX.com'), ('BASE2', 'http://www.XXXXXXXX.com/imageuploader'), ('CONTENT_LENGTH', '111695'), ('CONTENT_TYPE', 'image/jpeg'), ('GATEWAY_INTERFACE', 'CGI/1.1'), ('HTTP_CONTENT_DISPOSITION', 'attachment; filename="image01-07-29_05-54-26-96.jpg"'), ('HTTP_HOST', '127.0.0.1:9673'), ('HTTP_MAX_FORWARDS', '10'), ('HTTP_USER_AGENT', 'Axis shttpclien t $Revision: 1.45 $'), ('HTTP_VIA', '1.0 www.XXXXXXXX.com'), ('HTTP_X_FORWARDED_FOR', 'XX.XXX.XXX.XXX'), ('HTTP_X_FORWARDED_HOST', 'XXXXXXXX.com'), ('HTTP_X_FORWARDED_SERVER', 'www.XXXXXXXXX.com'), ('PARENTS', [<Folder at /XXX>, <Application at >]), ('PATH_INFO', '/VirtualHostBase/http/www.XXXXXXXX.com:80/XXX/VirtualHostRoot/imageuploader'), ('PATH_TRANSLATED', '/VirtualHostBase /http/www.XXXXXXXX.com:80/XXX/VirtualHostRoot/imageuploader'), ('PUBLISHED', <PythonScript at /XXX/imageuploader>), ('REMOTE_ADDR', '127.0.0.1'), ('REQUEST_METHOD', 'POST'), ('RESPONSE', ZServerHTTPRe sponse('')), ('SCRIPT_NAME', ''), ('SERVER_NAME', 'localhost'), ('SERVER_PORT', '9673'), ('SERVER_PROTOCOL', 'HTTP/1.1'), ('SERVER_SOFTWARE', 'Zope/(Zope 2.9.6-final, python 2.4.4, linux2) ZServer/1.1'), ('SERVER_URL', 'http://www.XXXXXXXX.com'), ('SESSION', id: 12155753281337189705, token: 99836730A3cKJMzoaVU, content keys: []), ('TraversalRequestNameStack', []), ('URL', 'http://www.XXXXXXXX.com/ imageuploader'), ('URL0', 'http://www.XXXXXXXX.com/imageuploader'), ('URL1', 'http://www.XXXXXXXX.com'), ('VIRTUAL_URL', 'http://www.XXXXXXXX.com/imageuploader'), ('VIRTUAL_URL_PARTS', ('http://www.XXXXXXXX.com', 'imageuploader')), ('VirtualRootPhysicalPath', ('', 'XXX')), ('__aca', '/36gevRRS99FhE%2BrH6GVLeSzXzA%3D%0A'), ('traverse_subpath', [])]
there is nothing in REQUEST.form
Just a thought... could your front-end (apache?) be stripping out the image due to attachment size restrictions or some other restriction? Jonathan
William Heymann wrote:
('__aca', '/36gevRRS99FhE%2BrH6GVLeSzXzA%3D%0A'), ('traverse_subpath', [])]
there is nothing in REQUEST.form
I wonder if your webcam is doing something weird like putting the image in the body of the post rather than in the form data? I had to admit to never having heard of a webcam doing this kind of posting anyway... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Can you use ftp or webdav, that may be easier, this would take care of mimetypes without having to move to a lower level. It depends on the capabilities of your camera but not knowing the model there is limited help. I had an Axis camera, that ran embedded linux and had a built in python web server (boa) which I used to get an image from the camera every 5 seconds replacing the previous image for viewing from our WEB site. And, I had to put the image directly on the file system and use the Local File System product for Zope to access it because it was always downloaded under the same file name and putting it in Zope directly quickly filled up the hard drive because of the undo option, a learning experience. It's been so long ago I don't remeber all of the details. Thomas On Wednesday 09 July 2008 00:16, William Heymann wrote:
I am trying to integrate a webcamera with a site and I can get it to POST the data to a certain url on the server the problem is I can't figure out how to get access to the data. It is not in REQUEST.form
the relevant request vars are
('CONTENT_LENGTH', '111695') ('CONTENT_TYPE', 'image/jpeg') ('HTTP_CONTENT_DISPOSITION', 'attachment; filename="image01-07-29_05-54-26-96.jpg"')
This is being posted to a python script object inside zope, however if I need to use an external method that is not a problem I just need to figure out how to get the data.
Thanks _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- ==================================================================== Thomas McMillan Grant Bennett Appalachian State University Operations & Systems Analyst P O Box 32026 University Library Boone, North Carolina 28608 (828) 262 6587 "... using OpenOffice.org, and save them back to disk automatically, in MS Word format. They surf the Web, check e-mail, do instant messaging, view YouTube videos, visit their Facebook pages, learn touch-typing skills and lots more. Our public library has been offering these Linux public stations for the past three years." - Phil Shapiro Linux Journal January 2008 Library Systems Help Desk: https://www.library.appstate.edu/help/ ====================================================================
participants (5)
-
Chris Withers -
Jonathan -
Thomas Bennett -
Tino Wildenhain -
William Heymann