473,574 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3098
On Wed, May 31, 2006 at 11:37:47AM -0700, yi*****@gmail.c om 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.c om 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***********@a cm.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.c om 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.


Misunderstandin g 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.c om 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***********@a cm.org


Jun 1 '06 #5
On 1/06/2006 11:52 AM, yi*****@gmail.c om 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.c om 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***********@a cm.org

Jun 1 '06 #6

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

Similar topics

2
2835
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 local connection. Problem: I have to create online ( on remote server ) some 6 tables and some 20 fields with MySql front. Ok. This shouldn't be...
4
25009
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 less complex technical calculations, several input variables. I would like to equipp the starting panel with the usual New, Open, Save, Save As, Close...
2
1792
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 day when they return to the office or they send the copy of the MDB, the Laptop version (with their current entries) has to be synchronized with the...
4
4514
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 tab delimited file or an excel file. The application then saves the file in the correct format. The flip side is for the user to import/upload the...
10
4099
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 : ---------------------------------------------------------- ADODB.Recordset error '800a0bb9' Arguments are of the wrong type, are out of acceptable range, or are in...
12
6196
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 datagrid. Once I can get to that point I need some way to be able to add new data only to the new columns that were added. Here is some of my...
4
4648
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 have been successfully registered.</div>"); within 1.5 seconds. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
6
8147
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 server mobile ce database. Until recently I was synching everything thru a com port serial cable. The devices would connect to the computer thru...
11
5002
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 database, in in both VB6 and VB.NET applications, I got the error "The Microsoft Jet database engine cannot find the input table or query...
0
7720
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8230
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7810
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8096
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5618
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5299
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3739
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1337
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1056
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.