PDA

View Full Version : Use browser's cookies in programs. Yay/Nay?



txtsd
09-23-2015, 06:25 AM
Are there any downsides to using neopets' cookies from Firefox or Chrome in programs?

Pros:

No need to login every time program runs. Already logged in because of cookie from browser.
No need to relogin when going back to browser.
You can use the browser and the program simultaneously. It will be like doing things in different tabs. (Only with lightweight activities like checking inventory or banking NPs or reading drama on neoboards or whatever)
Useragent is always the same


Cons:
idk. Could this cause any problems?

DarkByte
09-24-2015, 06:12 AM
Well neopets switches session id every few refreshes so your cookie for the browser would get invalidated or the cookie for your program would. You might be able to overwrite a cookie file that the browser stores but then theres issues like different browsers using different methods or you might try and write to a file at the same time as a browser and get permission errors. User agents are also not set via cookie :P.

If you want a browser like cookie function just:
1. on successfull login save cookie file using cookiejar functioin in python to a file.
2.Constantly save new cookie on session change or on each request in ur wrapper.
3.when user closes program and logs back in to same account try to use the cookie first , if the login is no longer valid - then login like step one.

Easiest way would be to have a folder called cookies then a file username.txt and check for that file on login.