Earn 500+ daily Microsoft rewards points automatically with a simple Python program

Prateek
5 min readNov 4, 2018
Microsoft rewards

Microsoft rewards users for using their Bing search engine with points. You can redeem these points as various gift cards, sweepstakes and donations to organizations. One can earn a lot of points just by using Edge browser and using Bing as search engine. I do not use Bing as my default search engine , instead of myself forcing to use it I thought of writing and scheduling program that runs everyday to give me maximum points without any effort.

For this I thought what better programming language than Python ! I have some skills with requests , Beautifulsoup. I tried but one has to login to get rewards so it was tough to automate login with these two. Then with some research I found that Selenium python is package good fit for this.

Packages/Resources we need:

random — randomizing selection of search words

json — load JSON strings

time — adding delays

requests — querying URL

selenium — for automating browser

Edge web driver — because additional 20 points for using edge

Firefox web driver — optional , you can do with Edge too.

Download Edge web driver from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ save it in convenient location. You need to chose correct version of driver for your machine, my Windows machine is on Release 17134 at the time of writing this blog.

We may also want Firefox web driver Geckodriver , I am using that to emulate mobile browsing and earn 200 points. Link for downloading Mozilla Firefox geckodriver is — https://github.com/mozilla/geckodriver/releases ; choose the appropriate one for per your computer architecture.

Programming

So lets jump right into programming shall we?

Import all packages

imports

Write a delay function which provides delay when URL is being loaded, provide a default delay in parameter.

wait_for function

Get random list of words from a website or create your own and store in a list.

I found randomlists.com website for some random word list in JSON, query URL from requests and convert the response and random simple it for N words. Below I have chosen 60 words.

random list of words selection

Next we use selenium to run these drivers from python code, remember to call wait_for(N) function to add delays in between ,

driver initialize

Now login with your credentials , but from code. We use find_element_by_name function to identify login field and proceed button click. Awesome when you don’t have to press even button with this. Isn’t it?

login with key strokes

I have put this block in try-catch block since sometimes I am already logged in to Bing and it wont find the login fields.

Once logged in we straight ahead query the words with Bing search engine. Its very simple is it supports q= mode of parameter passing. I am also validating result by printing it on console.

Some queries can be thought as location search queries by engine and it will pop a location request which will break the program execution, so hence there is again try-catch for each query.

Bing query for-each loop

The last line closes the web driver, you can comment it ,sometimes due to insufficient delays login wont work or your browsing activity is not counted in. Then you can just manually login to gain those pending points.

Mobile browsing points :

I also thought it would be nice if we had selenium mobile web drivers, I could not find useful one so I checked if we can change user agent of selenium driver , and of course we can. I just checked what is my user agent from my phone and modified one step in programming and driver is thought to be a mobile. This can be done by FirefoxProfile class and setting custom user agent as preference.

cell phone browsing — user agent

That’s it, if you run the program with this change you will get mobile browsing points, make sure to change the number of random words chosen to be 40 since its 200 points limit.

We can one python file to call both Edge and Firefox drivers and be done with 300+200+20 = 520 points at once, but to separate things out I made 2 files

Next step is to schedule these files in running on windows everyday, I don't suppose you wanted it to manually run every day. It took some time to figure out correct parameter option for Task scheduler scheduling option , since by default it takes system user group and was unable to fire python program.

Scheduling Python program for daily run

Go to Start → Task scheduler → Task Scheduler Library → Right Click → Create a task

General task settings

In Security options change the running user to yourself by searching it as below.

Security — User

Add a daily trigger

Trigger settings

Add an Action to run python executable and .py file we just wrote.

Action — python file locations

Modify settings so that task can be run ad-hoc and kills itself if stuck for long , and parallelization is enabled.

That’s it, save it and check it runs manually.

Full Code

Entire code can be found at Github/pmahend1/BingRewards

Summary

With selenium we can automate fixed browsing activities, since its available on Python code is short and sweet. This is an attempt to make use of basic Python coding skills and also explore Windows task scheduler. Main goal is to have fun and still be lazy! Hope you guys try it out and have fun automating too. Let me know if it works for you.

Thanks for reading.

--

--