Re: **************************************************************

2008-03-28 Thread Jetus
On Mar 28, 5:44 am, [EMAIL PROTECTED] wrote:
> **
> When you make a Web page available offline, you
> can read its content when your computer is not
> connected to the Internet. For example, you can
>  view Web pages on your laptop computer when you
>  don't have a network or Internet connection. Or
> you can read Web pages at home without tying up
> a phone line.
>
> You can specify how much content you want available,
> such as just a page, or a page and all its links, and
>  choose how you want to update that content on your computer.
>
> If you just want to view a Web page offline, and you don't
>  need to update the content, you can save the page on your
> computer. There are several ways you can save the Web page,
>  from just saving the text to saving all of the images and
> text needed to display that page as it appears on the Web.
> ***
> http:\\my profile6529.blogspot.com

Can't bring up your link..
 http:\\my profile6529.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


downloading a link with javascript in it..

2008-05-12 Thread Jetus
I am able to download this page (enclosed code), but I then want to
download a pdf file that I can view in a regular browser by clicking
on the "view" link. I don't know how to automate this next part of my
script. It seems like it uses Javascript.
The line in the page source says
href="javascript:openimagewin('JCCOGetImage.jsp?
refnum=DN2007036179');" tabindex=-1>

So, in summary, when I download this page, for each record, I would
like to initiate the "view" link.
Can anyone point me in the right direction?

When the "view" link is clicked on in IE or Firefox, it returns a pdf
file, so I should be able to download it with
urllib.urlretrieve('pdffile, 'c:\temp\pdffile')

Here is the following code I have been using

import urllib, urllib2

params = [
('booktype', 'L'),
('book', '930'),
('page', ''),
('hidPageName', 'S3Search'),
('DoItButton', 'Search'),]

data = urllib.urlencode(params)

f = urllib2.urlopen("http://www.landrecords.jcc.ky.gov/records/
S3DataLKUP.jsp", data)

s = f.read()
f.close()
open('jcolib.html','w').write(s)

--
http://mail.python.org/mailman/listinfo/python-list


Re: downloading a link with javascript in it..

2008-05-13 Thread Jetus
On May 12, 4:06 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Jetus schrieb:
>
>
>
> > I am able to download this page (enclosed code), but I then want to
> > download a pdf file that I can view in a regular browser by clicking
> > on the "view" link. I don't know how to automate this next part of my
> > script. It seems like it uses Javascript.
> > The line in the page source says
> > href="javascript:openimagewin('JCCOGetImage.jsp?
> > refnum=DN2007036179');" tabindex=-1>
>
> > So, in summary, when I download this page, for each record, I would
> > like to initiate the "view" link.
> > Can anyone point me in the right direction?
>
> > When the "view" link is clicked on in IE or Firefox, it returns a pdf
> > file, so I should be able to download it with
> > urllib.urlretrieve('pdffile, 'c:\temp\pdffile')
>
> > Here is the following code I have been using
> > 
> > import urllib, urllib2
>
> > params = [
> > ('booktype', 'L'),
> > ('book', '930'),
> > ('page', ''),
> > ('hidPageName', 'S3Search'),
> > ('DoItButton', 'Search'),]
>
> > data = urllib.urlencode(params)
>
> > f = urllib2.urlopen("http://www.landrecords.jcc.ky.gov/records/
> > S3DataLKUP.jsp", data)
>
> > s = f.read()
> > f.close()
> > open('jcolib.html','w').write(s)
>
> Use something like the FireBug-extension to see what the
> openimagewin-function ultimately creates as reqest. Then issue that,
> parametrised from parsed information out of the above href.
>
> There is no way to interpret the JS in Python, let alone mimic possible
> browser dom behavior.
>
> Diez

Thanks Diez;
Never used Firebug, and could not find the http-header section, but it
lead me to Tamper Data, and that was perfect to give me the headers.
Thanks for the input.
--
http://mail.python.org/mailman/listinfo/python-list


Re: downloading a link with javascript in it..

2008-05-13 Thread Jetus
On May 12, 6:59 pm, 7stud <[EMAIL PROTECTED]> wrote:
> On May 12, 1:54 pm, Jetus <[EMAIL PROTECTED]> wrote:
>
> > I am able to download this page (enclosed code), but I then want to
> > download a pdf file that I can view in a regular browser by clicking
> > on the "view" link. I don't know how to automate this next part of my
> > script. It seems like it uses Javascript.
> > The line in the page source says
>
> > href="javascript:openimagewin('JCCOGetImage.jsp?
> > refnum=DN2007036179');" tabindex=-1>
>
> 1) Use BeautifulSoup to extract the path:
>
> JCCOGetImage.jsp?refnum=DN2007036179
>
> from the html page.
>
> 2) The path is relative to the current url, so if the current url is:
>
> http://www.landrecords.jcc.ky.gov/records/S3DataLKUP.jsp
>
> Then the url to the page you want is:
>
> http://www.landrecords.jcc.ky.gov/records/JCCOGetImage.jsp?refnum=DN2...
>
> You can use urlparse.urljoin() to join a relative path to the current
> url:
>
> import urlparse
>
> base_url = 'http://www.landrecords.jcc.ky.gov/records/S3DataLKUP.jsp'
> relative_url = 'JCCOGetImage.jsp?refnum=DN2007036179'
>
> target_url = urlparse.urljoin(base_url, relative_url)
> print target_url
>
> --output:--http://www.landrecords.jcc.ky.gov/records/JCCOGetImage.jsp?refnum=DN2...
>
> 3) Python has a webbrowser module that allows you to open urls in a
> browser:
>
> import webbrowser
>
> webbrowser.open("www.google.com")
>
> You could also use system() or os.startfile()[Windows], to do the same
> thing:
>
> os.system(r'C:\"Program Files"\"Mozilla Firefox"\firefox.exe')
>
> #You don't have to worry about directory names
> #with spaces in them if you use startfile():
> os.startfile(r'C:\Program Files\Mozilla Firefox\firefox.exe')
>
> All the urls you posted give me errors when I try to open them in a
> browser, so you will have to sort out those problems first.

7Stud;
Thanks for sharing your knowledge!!

1)The proper url to the website is 
http://www.landrecords.jcc.ky.gov/records/S0Search.html.

2) The join won't work. I found that the request it sends is
http://206.196.0.195/cgi-bin/webview/SEND2.PGM?dispfmt=&itype=Q&authorization=&parm2=SD76070B
It looks like it generates a random code for param2...
I have two choices for generating this javascript,
I can click on the View, or in the form, if I put a "i" in the code
and click on the
option link, it will send me pdf file.

3) Was not sure why you suggested I use the Webbrowser module?
But I am glad to find out about it.
--
http://mail.python.org/mailman/listinfo/python-list


Learning curve for new database program with Python?

2008-04-05 Thread Jetus
I have a need for a database program. I downloaded the db2 from ibm,
and reviewed some of the documentation.

My question is, what is the easiest program for me to try to learn. I
will be creating a database of about 25,000 records, it will be
relational. I am a beginner Python programmer, and need a database
solution that is easy to grasp. I played with sql,
and found that very difficult, if not overly cumbersome.

A database that could work with Django would be very interesting to
look at as well..

Any suggestions out there?
-- 
http://mail.python.org/mailman/listinfo/python-list


creating a list from a inconsistent text file

2008-05-02 Thread Jetus
I have a comma delimited file that is separated by comma's, and then
sometimes by ","

c:\temp\05-06-08\Sale1,659 CECIL,"659 CECIL,40211",
1,659,CECIL,AVENUE,LOUISVILLE,40211,"$65,276.78 "
c:\temp\05-06-08\Sale2,637 SOUTH 27TH,"637 SOUTH 27TH,40211",
2,637,SOUTH 27TH,STREET,LOUISVILLE,40211,"$45,456.95 "
c:\temp\05-06-08\Sale3,2709 ELLIOT,"2709 ELLIOT,40211",
3,2709,ELLIOT,AVENUE,LOUISVILLE,40211,"$49,349.66 "


I would like to pick out data in a particular column. So am I right in
thinking that I would need to covert each line into a list, then
choose the appropriate column via a index?

How do I convert that line into a list?
--
http://mail.python.org/mailman/listinfo/python-list


Re: creating a list from a inconsistent text file

2008-05-02 Thread Jetus
On May 2, 7:19 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Fri, 02 May 2008 04:14:47 -0700, Jetus wrote:
> > I have a comma delimited file that is separated by comma's, and then
> > sometimes by ","
>
> > c:\temp\05-06-08\Sale1,659 CECIL,"659 CECIL,40211",
> > 1,659,CECIL,AVENUE,LOUISVILLE,40211,"$65,276.78 "
> > c:\temp\05-06-08\Sale2,637 SOUTH 27TH,"637 SOUTH 27TH,40211",
> > 2,637,SOUTH 27TH,STREET,LOUISVILLE,40211,"$45,456.95 "
> > c:\temp\05-06-08\Sale3,2709 ELLIOT,"2709 ELLIOT,40211",
> > 3,2709,ELLIOT,AVENUE,LOUISVILLE,40211,"$49,349.66 "
>
> The items are always delimited by commas but some items themselves contain
> a comma and therefore are enclosed in double quotes.  So it's not
> inconsistent.
>
> > How do I convert that line into a list?
>
> Use the `csv` module in the standard library.
>
> Ciao,
> Marc 'BlackJack' Rintsch

Hello Marc;
Thanks for the input! I am worried about the comma in the "" data
items, how do I tell Python to look for the "" data first, then use
the comma separator?
--
http://mail.python.org/mailman/listinfo/python-list


saving a webpage's links to the hard disk

2008-05-03 Thread Jetus
Is there a good place to look to see where I can find some code that
will help me to save webpage's links to the local drive, after I have
used urllib2 to retrieve the page?
Many times I have to view these pages when I do not have access to the
internet.
--
http://mail.python.org/mailman/listinfo/python-list


Re: saving a webpage's links to the hard disk

2008-05-06 Thread Jetus
On May 4, 7:22 am, [EMAIL PROTECTED] wrote:
> On May 4, 12:33 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
> wrote:
>
> > En Sun, 04 May 2008 01:33:45 -0300, Jetus <[EMAIL PROTECTED]> escribió:
>
> > > Is there a good place to look to see where I can find some code that
> > > will help me to save webpage's links to the local drive, after I have
> > > used urllib2 to retrieve the page?
> > > Many times I have to view these pages when I do not have access to the
> > > internet.
>
> > Don't reinvent the wheel and use wgethttp://en.wikipedia.org/wiki/Wget
>
> > --
> > Gabriel Genellina
>
> A lot of the functionality is already present.
>
> import urllib
> urllib.urlretrieve( 'http://python.org/', 'main.htm' )
> from htmllib import HTMLParser
> from formatter import NullFormatter
> parser= HTMLParser( NullFormatter( ) )
> parser.feed( open( 'main.htm' ).read( ) )
> import urlparse
> for a in parser.anchorlist:
> print urlparse.urljoin( 'http://python.org/', a )
>
> Output snipped:
>
> ...http://python.org/psf/http://python.org/dev/http://python.org/links/http://python.org/download/releases/2.5.2http://docs.python.org/http://python.org/ftp/python/2.5.2/python-2.5.2.msi
> ...

How can I modify or add to the above code, so that the file references
are saved to specified local directories, AND the saved webpage makes
reference to the new saved files in the respective directories?
Thanks for your help in advance.
--
http://mail.python.org/mailman/listinfo/python-list