Web Analytics Made Easy -
StatCounter Using Python to launch IDEC SmartRelay Web Server and login. - CodingForum

Announcement

Collapse
No announcement yet.

Using Python to launch IDEC SmartRelay Web Server and login.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using Python to launch IDEC SmartRelay Web Server and login.

    Hi,

    I am new to Python and IDEC SmartRelay PLC. I could not find any information about Python with IDEC SmartRelay.

    import webbrowser
    new = 2 # open in a new tab, if possible
    # open a public URL, in this case, the webbrowser docs
    url = "http://192.168.0.1/pdt_login.shtm?!App-Language=1" # IDEC SmartRelay Web Server Login Page
    webbrowser.open(url,new=new)

    From the above program, I am able to launch my SmartRelay Web Server page. But, I do not know how can I make it to be able to auto-login.

    values = {'input_password': 'IDEC',
    'select_language': '1'}

    data = urllib.urlencode(values)
    cookies = cookielib.CookieJar()

    opener = urllib2.build_opener(
    urllib2.HTTPRedirectHandler(),
    urllib2.HTTPHandler(debuglevel=0),
    urllib2.HTTPSHandler(debuglevel=0),
    urllib2.HTTPCookieProcessor(cookies))

    response = opener.open(url, data)
    the_page = response.read()
    http_headers = response.info()

    Then, I add on the above programs. But, it can't auto-login. How can I go about it to solve this problem? or is there any other recommendation I can try?
Working...
X