You Are Here:

Community: Developer Discussion Boards

#1 Old Unknown protocol error - 2008-05-06, 12:01

Join Date: Apr 2008
Posts: 17
lalithak85
Offline
Registered User
Hi all,

I am trying to connect to a https site.I am using proxy and certificates also for this.I used browser.open(url) to open the site.When I am trying to run the program I am getting an error as shown below

urllib2.URLError: <urlopen error (1, 'error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol')>

Can anyone help me Why this error is coming??
Reply With Quote

#2 Old Re: Unknown protocol error - 2008-05-07, 10:43

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
Quote:
Originally Posted by lalithak85 View Post
Hi all,

I am trying to connect to a https site.I am using proxy and certificates also for this.I used browser.open(url) to open the site.When I am trying to run the program I am getting an error as shown below

urllib2.URLError: <urlopen error (1, 'error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol')>

Can anyone help me Why this error is coming??
hi lalithak85
not sure and also not getting that thread there was a long discussion on https have a look on that i m sure you are talking abt https not http.
have a feedback


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#3 Old Re: Unknown protocol error - 2008-05-07, 11:09

Join Date: Mar 2003
Posts: 937
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
Basically server tells that it doesn't understand your data. There could be several reasons for that, for example wrong port, different SSL/TLS versions, faulty installation at server side, buggy libraries at client side.

It's a generic error note, so exact reason and fix cannot be given without more info.

Cheers,

--jouni
Reply With Quote

#4 Old Re: Unknown protocol error - 2008-05-08, 05:31

Join Date: Apr 2008
Posts: 17
lalithak85
Offline
Registered User
Hi ,

I am very new to python.I have written a code to open up a https site using browser.open(url)
and then i want to post data into the form through python.
But it is displaying the error as

[color="Red"]"File "C:\Python25\lib\mechanize\_mechanize.py", line 203, in open
return self._mech_open(url, data)
File "C:\Python25\lib\mechanize\_mechanize.py", line 254, in _mech_open
raise response
mechanize._response.httperror_seek_wrapper: HTTP Error 400: Bad Request

I am using a proxy and also certificates also for authentication purpose..


I am writing the code below .please have a look it and tell me where the error is


I am getting the paramters from configuration file

import re
from mechanize import Browser
import sys
import os
sys.path.append('C:\\')
from configobj import ConfigObj
cfg = ConfigObj("parameters.ini")
site_id=cfg["site_id"]
admin_id=cfg["admin_id"]
admin_passwd=cfg["admin_passwd"]
https_proxy=cfg["proxy"]
print site_id
print admin_id
print admin_passwdos.environ["https_proxy"]=cfg["proxy"]
os.environ["https_pkcs12_file11"]=cfg["cert_file"]
os.environ["https_pkcs12_password"]=cfg["cert_passwd"]
CURRENT_USER_FILE=open("current-users.txt", "w")
br=Browser()
#proxycheckflag=False
br.set_handle_robots(False)
br.open(site_id)
br.select_form(nr = 1)

values1={'password':admin_passwd}
values = {'query' :"select user_id, login_name, email, real_name, organization from HELM_USER where HELM_USER.TYPE='base' and DOMAIN_ID=2"}
ctrl = browser.getControl(name='Run query')
ctrl.click()

This is the code Its getting struck at opening a site...


Please help me in this regard and tell me where the error is??
Reply With Quote

#5 Old Re: Unknown protocol error - 2008-05-08, 08:00

Join Date: Mar 2003
Posts: 937
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
Huh,

Too much unreadable code! Please use [ code ] and [ / code ] tags (without those spaces) to mark code lines, this will make it readable! You can edit your message afterwards to add them.

Go to your old message, press EDIT button at the end of the message at the left side. You will see a text box with your writing and some special wiki syntax tags. Add those [ code ] tags and save.

When in EDIT mode, there is button GO TO ADVANCED, which is a bit like the original message creation view. There you have PREVIEW button, very useful when you're not quite sure how those tags work.

Final tip: look around the other messages and when you see a nice effect (bold, italics, COLOR, code, quote, etc) just press QUOTE button and look at the wiki syntax.

Code:
    def my_func(a_value):
        ''' Example '''
        my_value = a_value

    my_func(5)
Quote:
Quote
Enjoy,

--jouni
Reply With Quote

#6 Old Re: Unknown protocol error - 2008-05-08, 08:03

Join Date: Mar 2003
Posts: 937
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
Quote:
Originally Posted by lalithak85 View Post
HTTP Error 400: Bad Request
The HTTP/1.1 specification says:

Quote:
10.4.1 400 Bad Request

The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
Cheers,

--jouni
Reply With Quote

#7 Old Re: Unknown protocol error - 2008-05-08, 08:30

Join Date: Apr 2008
Posts: 17
lalithak85
Offline
Registered User
Hi Jom,

Thanks for your suggestion.I will do it now.But Is there any mistake in my code??WHy is it showing such error.
Reply With Quote

#8 Old Re: Unknown protocol error - 2008-05-08, 09:02

Join Date: Apr 2008
Posts: 17
lalithak85
Offline
Registered User
Hi Jom,

What I have observed is when I am calling browser.open(url).It is calling _mechanize.py which is actually generating the response.What I have observed is in _mechanize.py I tried to print the request and I am observing that it is printed twice.It means that request is going twice..Is there any problem in _mechanize.py????
Reply With Quote

#9 Old Re: Unknown protocol error - 2008-05-09, 00:25

Join Date: Mar 2003
Posts: 937
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
Quote:
Originally Posted by lalithak85 View Post
What I have observed is in _mechanize.py I tried to print the request and I am observing that it is printed twice.It means that request is going twice..Is there any problem in _mechanize.py????
If your URL is correct, then you can use it even three times However the error code told that URL was incorrect, so you might want to print that, copy to desktop web browser and see whether it works from there.

Cheers,

--jouni who has never used mechanize and cannot answer any such questions
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing file content hendrawan.ashari General Symbian C++ 7 2007-03-09 11:41
problem with the XML Parser SyExpat Vitaly_iva General Symbian C++ 2 2006-06-05 12:09
codewarrior中编译出错?(每个例子均是一样) uufile Symbian 3 2005-09-13 06:37
Cannot compile SDK's examples for 7650 platform... midletsoft Symbian Tools & SDKs 2 2003-08-12 20:11
how to avoid linking error skdas General Symbian C++ 6 2003-07-07 08:57

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia