473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Save data to a file thru a http connection

Hi,

I am new to python. I read an example here about how to fetch data thru
a HTTP connection:
http://diveintopython.org/http_web_services/review.html,

My question is how can i save the data to a file after reading it from
a http connection.

Thank you.

May 31 '06 #1
5 3092
On Wed, May 31, 2006 at 11:37:47AM -0700, yi*****@gmail.com wrote:
I am new to python. I read an example here about how to fetch data thru
a HTTP connection:
http://diveintopython.org/http_web_services/review.html,

My question is how can i save the data to a file after reading it from
a http connection.


Usually HTTP is read-only. There are extensions like WebDAV though that
may do what you need. Google for "python webdav" and see how far you get.

Kindly
Christoph
May 31 '06 #2
yi*****@gmail.com wrote:
I am new to python. I read an example here about how to fetch data thru
a HTTP connection:
http://diveintopython.org/http_web_services/review.html,

My question is how can i save the data to a file after reading it from
a http connection.


Do the tutorial and this and many other things will become clear.

Instead of just "print sometext", do something like:
...
f = open('filename', 'w')
...
print >>f, sometext
... (possibly more prints like the above).
f.close()

--Scott David Daniels
sc***********@acm.org
May 31 '06 #3
On Wed, May 31, 2006 at 08:58:53PM +0200, Christoph Haas wrote:
On Wed, May 31, 2006 at 11:37:47AM -0700, yi*****@gmail.com wrote:
I am new to python. I read an example here about how to fetch data thru
a HTTP connection:
http://diveintopython.org/http_web_services/review.html,

My question is how can i save the data to a file after reading it from
a http connection.


Usually HTTP is read-only. There are extensions like WebDAV though that
may do what you need. Google for "python webdav" and see how far you get.


Misunderstanding on my side. Ignore me. :)

Christoph

May 31 '06 #4
Scott,

Can you please tell me which chapter of the tutorial that you are
referring to http://docs.python.org/tut/tut.html?

The only chapter that I find about http is chapter 10.7, but it does
not have the example that you are referring to

Scott David Daniels wrote:
yi*****@gmail.com wrote:
I am new to python. I read an example here about how to fetch data thru
a HTTP connection:
http://diveintopython.org/http_web_services/review.html,

My question is how can i save the data to a file after reading it from
a http connection.


Do the tutorial and this and many other things will become clear.

Instead of just "print sometext", do something like:
...
f = open('filename', 'w')
...
print >>f, sometext
... (possibly more prints like the above).
f.close()

--Scott David Daniels
sc***********@acm.org


Jun 1 '06 #5
On 1/06/2006 11:52 AM, yi*****@gmail.com wrote:
Scott,

Can you please tell me which chapter of the tutorial that you are
referring to http://docs.python.org/tut/tut.html?

The only chapter that I find about http is chapter 10.7, but it does
not have the example that you are referring to

Break the problem up into two parts:

(1) Get some data.

You've achieved that, using HTTP.

(2) Save some data to a file.

Doesn't matter *how* you got the data. You need to know how to open a
file for writing and how to write to it and how to close it when you've
finished. Look for the section in the tutorial about *files*.

Better still, read *all* the sections in the tutorial :-)


Scott David Daniels wrote:
yi*****@gmail.com wrote:
I am new to python. I read an example here about how to fetch data thru
a HTTP connection:
http://diveintopython.org/http_web_services/review.html,

My question is how can i save the data to a file after reading it from
a http connection.

Do the tutorial and this and many other things will become clear.

Instead of just "print sometext", do something like:
...
f = open('filename', 'w')
...
print >>f, sometext
... (possibly more prints like the above).
f.close()

--Scott David Daniels
sc***********@acm.org

Jun 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Atz | last post by:
Hi to all ! Im using MySql front and PHP 5 for some web shop. I didn't try it so far but i guess that the online data insertation ( accept costs and time ) should be the same process like for...
4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
2
by: Ray | last post by:
Hi, I have an Access 97 Database on the server, which gets updated from Desktops thru a LAN. Employees who have to go to offsite locations, carry the latest copy of the MDB. At the end-of-the...
4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
10
by: Kasp | last post by:
When I try and save out a recordset from an ASP page as XML I get the following error (the code is below) - I have ADO 2.8 installed and this is running on win XP sp2 : ...
12
by: JMO | last post by:
I can import a csv file with no problem. I can also add columns to the datagrid upon import. I want to be able to start importing at the 3rd row. This will pick up the headers necessary for the...
4
by: sufian | last post by:
Below is the field where user enters his/her email address and the AJAX post request is sent to the server and the user sees the message: echo("<div id=\"message\" class=\"success\">Thank you! You...
6
Cintury
by: Cintury | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql...
11
by: fniles | last post by:
One of our application uses VB6 and Access97 database. Another application uses VB.NET 2005. This morning for about 15 seconds when the application tries to read either a query or a table from the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.