All for Joomla All for Webmasters
Python

Gokano: daily points bot collector in Python with Mechanize

Gokano is a free web platform for collecting points that can be exchanged for prizes. To participate, the user must register and accomplish some tasks in order to win those points that can be traded when the items are available on stock (it’s worth to say that it’s really competitive ’cause there are too many users for a few items on stock). Among these tasks, some examples are to follow some profiles on social networks, answer to surveys and some other assignments that take benefit from the large number of users of the platform.


Explanation of platform usage

There’s also a task that’s available once a day which is only to click on a button (a well known gamification practice to maintain the users constantly engaged). Once it’s an automated task, we can use a library to implement a script that emulates a web browser. In this post, I’m gonna use Mechanize for Python. You can install it through PIP package manager:

In this example, I’m gonna emulate a Mozilla Firefox browser (it’s not really relevant, but in case Gokano’s server stores that information, it will be a valid browser). To run that script, the only arguments you’ll need to provide are the email address and password for your account.

THE SOURCE CODE

You can notice that the script runs in a loop trying to collect the point and sleeping before making a new attempt. It sleeps for 1 day on success and 1 minute when some error occurs  (connection failure, for example). If you want to improve the algorithm, a suggestion would be to daemonize the script, in order to run it on background so you can run it remotely without keeping the console open. I’ll show how to do that in a later post. If you have any doubts or suggestions, please use the comment area or contact me.

You Might Also Like

1 Comment

  • Reply
    Sannytet
    December 12th, 2018 at 00:29

    Nice posts! 🙂
    ___
    Sanny

  • Leave a Reply to Sannytet Cancel Reply