By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

connect to https unpossible. Please help.

P: n/a
Hi,

i want to log via python script to https page:

'https://brokerjet.ecetra.com/at/'
#
But it does not work.

I am using following code(see below)

Has somebody any ideas?
How can I get to this https page?
Need I to know some infos from "provider"(certificates, etc)?
Thank u very much !

sincerely mark

Code:
======
import urllib2

theurl='https://brokerjet.ecetra.com/at/'
#
username = 'username'
password = 'password'
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, theurl, username, password)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
t = urllib2.urlopen('https://brokerjet.ecetra.com/at/')
#
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\Program Files\python233\lib\urllib2.py", line 129, in urlopen
return _opener.open(url, data)
File "C:\Program Files\python233\lib\urllib2.py", line 326, in open
'_open', req)
File "C:\Program Files\python233\lib\urllib2.py", line 306, in _call_chain
result = func(*args)
File "C:\Program Files\python233\lib\urllib2.py", line 908, in https_open
return self.do_open(httplib.HTTPS, req)
File "C:\Program Files\python233\lib\urllib2.py", line 886, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (10060, 'Operation timed out')>
--
Highspeed-Freiheit. Bei GMX supergünstig, z.B. GMX DSL_Cityflat,
DSL-Flatrate für nur 4,99 Euro/Monat* http://www.gmx.net/de/go/dsl
Oct 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Mark Delon" <ma********@gmx.at> wrote:

i want to log via python script to https page:

'https://brokerjet.ecetra.com/at/'
#
But it does not work.

I am using following code(see below)

Has somebody any ideas?
How can I get to this https page?
Need I to know some infos from "provider"(certificates, etc)?
Thank u very much !


You are trying to set this up to use HTTP BasicAuth authorization, but this
page is not using HTTP authorization. You can recognize HTTP authorization
by the separate browser window that pops up to ask for your username and
password.

In this case, the username and password fields are just ordinary fields on
a form. What you need to do is read the HTTP on that page, and figure out
how to send a URL containing values for those fields. In this case, the
form data goes to
https://brokerjet.ecetra.com/at/welc...inaction.phtml, and you'll need
to encode 'login' and 'pwd' fields in the POST data.

However, that isn't the end of your trouble. That page will almost
certainly send you a cookie, which you will need to send back with every
request.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Oct 21 '05 #2

P: n/a
Hi Tim,

really than u very much!

I think u have helped me!

I will try, that what u said.

I have found probably simplier solution.
Is it so?

....but without success:-(.

I want to download some URLs via python script.
With some URLs I have success with some NOT.
Why?
I do following:
===============
1. Login to https://brokerjet.ecetra.com/at/welc...oginpage.phtml
via Mozzila browser
2. I try to download some URLs using cookies: see script bellow:
3. Some pages works (e.g. news, but on some pages I get:
--
Traceback (most recent call last):
File "test_stock.py", line 11, in ?
r =
opener.open("https://brokerjet.ecetra.com/at/trading/wt.phtml?isin=NL0000240000&exid=ETR")
File "C:\Programme\Python24\lib\urllib2.py", line 358, in open
response = self._open(req, data)
File "C:\Programme\Python24\lib\urllib2.py", line 376, in _open
'_open', req)
File "C:\Programme\Python24\lib\urllib2.py", line 337, in _call_chain
result = func(*args)
File "C:\Programme\Python24\lib\urllib2.py", line 1029, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "C:\Programme\Python24\lib\urllib2.py", line 996, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (10061, 'Connection refused')>

Details- Script:
=================
I make login via Mozilla browser

import os, cookielib, urllib2

cj = cookielib.MozillaCookieJar()
os.environ['HOME']= r"C:\tmp\COOKIE"
cj.load(os.path.join(os.environ["HOME"], "cookies.txt"))
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(c j))
# first URLs download works
r =
opener.open("http://brokerjet.ecetra.com/at/news/index.phtml?notation=7536885")
# second URLs download DOES NOT work ... WHY?
r =
opener.open("https://brokerjet.ecetra.com/at/trading/wt.phtml?isin=NL0000240000&exid=ETR")
#
h = r.readlines()
g = open("test.html","w")
g.writelines(h)
g.close()
os.system("test.html")

Thans realy for all ideas!
sincerely
mark
--- Ursprüngliche Nachricht ---
Von: Tim Roberts <ti**@probo.com>
An: py*********@python.org
Betreff: Re: connect to https unpossible. Please help.
Datum: Fri, 21 Oct 2005 06:05:45 GMT

"Mark Delon" <ma********@gmx.at> wrote:

i want to log via python script to https page:

'https://brokerjet.ecetra.com/at/'
#
But it does not work.

I am using following code(see below)

Has somebody any ideas?
How can I get to this https page?
Need I to know some infos from "provider"(certificates, etc)?
Thank u very much !


You are trying to set this up to use HTTP BasicAuth authorization, but
this
page is not using HTTP authorization. You can recognize HTTP
authorization
by the separate browser window that pops up to ask for your username and
password.

In this case, the username and password fields are just ordinary fields on
a form. What you need to do is read the HTTP on that page, and figure out
howfiues for those fields. In this case, the
form data goes to
https://brokerjet.ecetra.com/at/welc...inaction.phtml, and you'll need
to encode 'login' and 'pwd' fields in the POST data.

However, that isn't the end of your trouble. That page will almost
certainly send you a cookie, which you will need to send back with every
request.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list


--
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie
Oct 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.