steampy icon indicating copy to clipboard operation
steampy copied to clipboard

Random User-Agent

Open yesworId opened this issue 1 year ago • 13 comments

Would be useful adding User-Agents in steampy requests? I guess it'd help to handle captcha?

yesworId avatar Oct 23 '23 08:10 yesworId

It doesn't make sense. Steam servers remember you by ip (according to my observations). In theory, reboot the router and there will be no problems (but this is stupid). Why not just save the captcha and enter it? P. S. Esli tebya ne smushaet - mogu pisaty po russki.

MaxsonClackson avatar Oct 23 '23 18:10 MaxsonClackson

Because requests-python library has User-agent as "Python-requests/version" by default. And I guess random User-agents, or just list of few popular would be great to use. Just to show to the steam that you are real user, not a bot.

yesworId avatar Oct 23 '23 18:10 yesworId

Because requests-python library has User-agent as "Python-requests/version" by default. And I guess random User-agents, or just list of few popular would be great to use. Just to show to the steam that you are real user, not a bot.

it doesn't work that way. Steam requests a captcha for a large number of authorizations. Either save the cookies or enter the captcha yourself. What is the difficulty of sending a captcha?

MaxsonClackson avatar Oct 23 '23 18:10 MaxsonClackson

The problem is that captcha doesn't appear.

yesworId avatar Oct 23 '23 18:10 yesworId

Using cookies for authorization is already minimizing captcha appearing. I'm asking is adding User-agent would be a good feature. Maybe steam can block such a User-agent as "Python-requests"

yesworId avatar Oct 23 '23 18:10 yesworId

The problem is that captcha doesn't appear.

Download the captcha image to your PC and enter it! In the _check_for_captcha function, remove the raise call. In the response that you pass to the function, there is a captcha id. In the JSON response, take the key ["captcha_gid"] and send a request to upload an image. captacha_id = response["captcha_gid"] params = {'gid': captacha_id} url = "https://steamcommunity.com/login/rendercaptcha/" r = self.session.get(url=url, params=params) Save the image and enter. if r.status_code == 200: with open('captcha_gid.png', 'wb') as f: f.write(r.content) You can use input to send the captcha value. capcha_text = input('Enter capcha: ') P. S. sorry I don't know how to transfer a line of code

MaxsonClackson avatar Oct 23 '23 19:10 MaxsonClackson

Hmm, interesting. Thank you so much.

yesworId avatar Oct 23 '23 19:10 yesworId

I have a solution for entering captcha, but it's implemented through a breakpoint when captcha is required, and then entering it manually in the terminal via input. Not the most elegant, but the captcha needs to be entered manually.

wolfovik avatar Oct 23 '23 19:10 wolfovik

I have a solution for entering captcha, but it's implemented through a breakpoint when captcha is required, and then entering it manually in the terminal via input. Not the most elegant, but the captcha needs to be entered manually.

This would be great. Brodie, you gotta create a new pull request with it. Then we will manage together how to better enter captcha.

yesworId avatar Oct 23 '23 19:10 yesworId

I have a solution for entering captcha, but it's implemented through a breakpoint when captcha is required, and then entering it manually in the terminal via input. Not the most elegant, but the captcha needs to be entered manually.

This would be great. Brodie, you gotta create a new pull request with it. Then we will manage together how to better enter captcha.

Alright, as soon as I finish the current pull request, I'll create a new one and we'll find the optimal solution together.

PS I also plan to add a display for the on-hold balance. It's not right that random amounts disappear and then reappear on the balance after a few days.

PPS By the way, in my version, a random user agent is implemented. I don't think it's of great significance. Steam already knows it's a bot. It's very easy to tell based on several other factors.

wolfovik avatar Oct 23 '23 21:10 wolfovik

Awesome my man!

yesworId avatar Oct 23 '23 22:10 yesworId

#306 New update is ready. Now you can retrieve the on-hold Steam balance using get_wallet_balance(on_hold = True). For now, I'll finish working on the library, I need to get back to my own project. Unfortunately, I couldn't find the motivation to do captcha or logout, as these are quite rare and specific cases.

wolfovik avatar Oct 25 '23 00:10 wolfovik

#306 New update is ready. Now you can retrieve the on-hold Steam balance using get_wallet_balance(on_hold = True). For now, I'll finish working on the library, I need to get back to my own project. Unfortunately, I couldn't find the motivation to do captcha or logout, as these are quite rare and specific cases.

No worries, you did a good job.Is there any way I could contact you for information? Or you can message me in discord. Link in my bio.

yesworId avatar Oct 25 '23 11:10 yesworId