inderpreet99 / afraid-autologin

Automatically login to FreeDNS.Afraid.org to avoid termination due to dormant account
Apache License 2.0
21 stars 10 forks source link

[RFE] Python3 support #6

Open ckujau opened 4 years ago

ckujau commented 4 years ago

OK, this is not really a bug (yet), more like an enhancement request: with Python2 now in EOL status, afraid-autologin needs to be ported to Python3. By someone. Better yet, someone who can write Python3 :-)

Right now we have:

$ python3 -V
Python 3.6.9

$ python3 autologin.py
  File "autologin.py", line 95
    print input.get_attribute('value')
              ^
SyntaxError: invalid syntax
ckujau commented 4 years ago

Hmpf, should have tried this before opening this issue. So, no big rewrite appears to be needed, only a few tweak during installation and a small modification to autologin.py:

$ cd afraid-autologin
$ virtualenv --python=python3 venv

$ source venv/bin/activate
$ pip3 install -r requirements.txt
$ python3 autologin.py

Unfortunately autologin.py would produce an error when executed this way:

  File "autologin.py", line 95
    print input.get_attribute('value')
              ^
SyntaxError: invalid syntax

Instead of porting this statement to Python3, we can also disable it - it doesn't seem to affect the autlogin:

--- autologin.py.orig   2018-10-12 22:21:23.000000000 -0700
+++ autologin.py        2020-05-29 18:15:00.000000000 -0700
@@ -92,10 +92,10 @@
     logger.debug(buttons)
     for input in buttons:                                                             
     #print attribute name of each input element 
-       print input.get_attribute('value')
+    #  print input.get_attribute('value')
        if input.get_attribute('value') == "Extend your account" :
-           input.click()
-           break
+            input.click()
+            break
     browser.get(URL_DORMANT_EXTEND);

     time.sleep(random.randint(1,3))