×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    17

    Unknown protocol error

    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??

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Unknown protocol error

    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

  3. #3
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Unknown protocol error

    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

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    17

    Re: Unknown protocol error

    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??

  5. #5
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Unknown protocol error

    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
    Enjoy,

    --jouni

  6. #6
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Unknown protocol error

    Quote Originally Posted by lalithak85 View Post
    HTTP Error 400: Bad Request
    The HTTP/1.1 specification says:

    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

  7. #7
    Registered User
    Join Date
    Apr 2008
    Posts
    17

    Re: Unknown protocol error

    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.

  8. #8
    Registered User
    Join Date
    Apr 2008
    Posts
    17

    Re: Unknown protocol error

    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????

  9. #9
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Unknown protocol error

    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

Similar Threads

  1. Parsing file content
    By hendrawan.ashari in forum Symbian
    Replies: 7
    Last Post: 2007-03-09, 10:41
  2. problem with the XML Parser SyExpat
    By Vitaly_iva in forum Symbian
    Replies: 2
    Last Post: 2006-06-05, 11:09
  3. Cannot compile SDK's examples for 7650 platform...
    By midletsoft in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2003-08-12, 19:11
  4. how to avoid linking error
    By skdas in forum Symbian
    Replies: 6
    Last Post: 2003-07-07, 07:57

Posting Permissions

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