473,657 Members | 2,530 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 3099
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
2841
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 great problem ( i hope :-)).
4
25013
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 etc. menus (like in Excel, or Word, etc.) What is the best way to accomplish Save, or Save As?...
2
1797
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 MDB sitting on the server. How do I go about setting up this? I would appreciate suggestions...
4
4522
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 file to the server The application must be able to import the excel file and read the contents. I...
10
4115
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 conflict with one another.
12
6208
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 code: //Function For Importing Data From CSV File public DataSet ConnectCSV(string filetable)
4
4652
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta...
6
8156
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 activesync and are able to acquire an internet connection. The sync for the program occurs thru a website...
11
5012
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 'myTable'. Make sure it exists and that its name is spelled correctly." Also, I got the error "The...
0
8740
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1733
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.