After much research and help from forums, i have the following. Using HTMLParser to parse thru html pages and then finally reaching a webpage where i have to check all the checkboxes and then click the 'Deploy' button. Used ClientForm to do this. But i am getting some HTTP version error

URL = ""

#from urllib2 import urlopen
from HTMLParser import HTMLParser

import re
import ClientForm
import urllib2

# Fetching links using HTMLParser
def get_links(url):
    parser = MyHTMLParser()
    return parser.links

# Build url for Deploy page
def get_deploy_url():
    url = URL + "/buildresults/Poker-TTM_%s_nightly_build" % branch
    print url
    for link in get_links(url):
        if link["href"].startswith("Deploy"):
            return "%s/%s" % (URL, link["href"])

# Build url for Destination page
def get_destination_url():
    url = get_deploy_url()
    print url
    destination_re = re.compile(r"%s" % destination)
    for link in get_links(url):
        if destination_re.search(link["href"]):
            return "" + link["href"]
        print link["href"]

# Parsing HTML pages 
class MyHTMLParser(HTMLParser):
    def __init__(self, *args, **kwd):
        HTMLParser.__init__(self, *args, **kwd)
        self.links = []

    def handle_starttag(self, tag, attrs):
        if tag == "a":
            attrs = dict(attrs)
            if "href" in attrs:

    def handle_endtag(self, tag):

if __name__ == "__main__":
    # Read the branch name and the test destination to deploy on
    lines = [x.split(':') for x in open("branch_dest.txt")]
    print lines
    branch = "%s" % lines[0][1].strip()
    print branch
    destination = "%s" % lines[1][1].strip()
    print destination
    final_url = get_destination_url()
    if final_url is None:
        print "Cannot deploy here"
        print final_url
        request = urllib2.Request("%s" % final_url)
        response = urllib2.urlopen(request)
        forms = ClientForm.ParseResponse(response, backwards_compat = False)
        form = forms[0]
        print form
        form.find_control("all_top").items[0].selected = True
        form.find_control("client.POK_code").items[0].selected = True
        form.find_control("client.SVS_code").items[0].selected = True
        form.find_control("client.PAT_code").items[0].selected = True
        form.find_control("client.POK_code_gms").items[0].selected = True
        form.find_control("client.POK_code_gms_cpn").items[0].selected = True
        form.find_control("client.POK_code_mini").items[0].selected = True
        form.find_control("client.LTM_code").items[0].selected = True
        form.find_control("client.LTM_tot_code").items[0].selected = True
        form.find_control("client.POK_code_paradise").items[0].selected = True
        form.find_control("client.POK_code_forfun").items[0].selected = True
        form.find_control("client.POK_code_pokerheaven").items[0].selected = True
        form.find_control("client.POK_code_totalpoker").items[0].selected = True
        form.find_control("client.POK_code_las").items[0].selected = True
        form.find_control("client.POK_code_italian").items[0].selected = True
        form.find_control("client.POK_code_bulgarian").items[0].selected = True
        form.find_control("client.POK_code_finnish").items[0].selected = True
        form.find_control("client.POK_code_danish").items[0].selected = True
        form.find_control("client.POK_code_french").items[0].selected = True
        form.find_control("client.POK_code_greek").items[0].selected = True
        form.find_control("client.POK_code_german").items[0].selected = True
        form.find_control("client.POK_code_croatian").items[0].selected = True
        form.find_control("client.POK_code_polish").items[0].selected = True
        form.find_control("client.POK_code_portuguese").items[0].selected = True
        form.find_control("client.POK_code_romanian").items[0].selected = True
        form.find_control("client.POK_code_russian").items[0].selected = True
        form.find_control("client.POK_code_slovak").items[0].selected = True
        form.find_control("client.POK_code_spanish").items[0].selected = True
        form.find_control("client.POK_code_czech").items[0].selected = True
        form.find_control("client.POK_code_swedish").items[0].selected = True
        form.find_control("client.POK_code_hungarian").items[0].selected = True
        form.find_control("client.POK_code_turkish").items[0].selected = True
        form.find_control("client.POK_code_albanian").items[0].selected = True
        form.find_control("client.POK_code_austrian").items[0].selected = True
        form.find_control("client.POK_code_brazilian").items[0].selected = True
        form.find_control("all").items[0].selected = True
        print form

        ##request2 = form.click()
            response2 = urllib2.urlopen(request2)
        except urllib2.HTTPError, response2:

        print response2.geturl()
        print response2.read()

Below is the error

Traceback (most recent call last):
  File "C:\deploy_input_clientform.py", line 65, in <module>
    response = urllib2.urlopen(request)
  File "C:\Python26\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python26\lib\urllib2.py", line 397, in open
    response = meth(req, response)
  File "C:\Python26\lib\urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python26\lib\urllib2.py", line 435, in error
    return self._call_chain(*args)
  File "C:\Python26\lib\urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "C:\Python26\lib\urllib2.py", line 518, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 505: HTTP Version Not Supported

Please help!

Recommended Answers

10.5.6 505 HTTP Version Not Supported

The server does not support, or refuses to support, the HTTP protocol version that was used in the request message. The server is indicating that …

Jump to Post

All 2 Replies

10.5.6 505 HTTP Version Not Supported

The server does not support, or refuses to support, the HTTP protocol version that was used in the request message. The server is indicating that it is unable or unwilling to complete the request using the same major version as the client, as described in section 3.1, other than with this error message. The response SHOULD contain an entity describing why that version is not supported and what other protocols are supported by that server.

I read that too. But i could not figure out what the workaround to this problem was. Anybody has any ideas??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.