PDA

View Full Version : Keeping your python bots browser emulation updated. [Windows]



Stocking Anarchy
08-30-2017, 12:32 AM
First I would recommend reading this guide ([Only registered and activated users can see links]!-Stay-educated-with-the-latest!-2eap) written by |2eap to learn more about what user-agents are and why they are important. Forgive me programmers of clraik but I am going to talk about this stuff with non-programmer speak from how I interpret user-agents work.

In the most basic terms, user-agents tell Neopets what browser you are using when you are running a python bot. That is why I think of it as a browser emulator. The reason why keeping this information updated in your python bots is because Neopets does keep track of this data. So if you have been playing Neopets on Firefox 54 but you are using an older python bot that sends data as if you were playing Neoquest on a Firefox 40 browser that could potentially show red flags. Or if you play Neopets on Firefox but your python bots always sends data as if you were playing Google Chrome, another eyebrow raise.

The good thing is, it is very simple to update the user-agents yourself.

First open the browser you typically play neopets on and grab your User-agent data. A few sites you can get this info are:

useragentstring.com ([Only registered and activated users can see links])
[Only registered and activated users can see links] ([Only registered and activated users can see links])
[Only registered and activated users can see links] ([Only registered and activated users can see links])

Next go to your python bot folders and find the .py file that has the user-agent information contained. In Windows you can right click the .py file and choose Edit with Idle to see the code in each .py file. Some programmers will have the file that contains the user-agent info in a file called NeoAccount.py or NeoControls.py others may not have a .py file at all and you can set it in a text file. Good thing is, once you have found the .py file that contains this information, you don't have to keep looking. This will be the only .py file that you have to edit.

The code will look something like this


headers = [('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36'),

For the code above, that user agent is for a Chrome browser but I use Firefox. So I am going to change the code to the info the website useragentstring.com displays when I visit it on my browser.


headers = [('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0'),

then you just save the file and you are done.

Every time you have a browser update I would recommend updating your user-agents for bots you use regularly. If you use a bot only now and then, I would just double check the user-agent matches your browser before running the bot.

Stocking Anarchy
02-16-2019, 03:47 AM
Just wanted to bump this since it has been a while since I made the guide. Chrome recently updated so wanted to give a friendly PSA and reminder to everyone to make sure your user agents are up to date.