ValvePython / steam

ā˜ļø Python package for interacting with Steam
http://steam.readthedocs.io
MIT License
1.06k stars 129 forks source link

Any way change profile settings? #314

Closed OliverTrust closed 3 years ago

OliverTrust commented 3 years ago

Avatar - no way, nickname and status - change_status() profile link - ? real name - ? country - ? About myself - ?

And other settings (profile theme and etc)

rossengeorgiev commented 3 years ago

Not at the moment. There is an attempt at avatar upload in #290

step-FLOOR-ring commented 3 years ago

Are there any plans to get community settings changed in the near future? Wouldn't mind the ability to change custom profile URLs!

rossengeorgiev commented 3 years ago

It's just a single request.

wa = WebAuth('<username>')
wa.cli_login()

resp = wa.session.post('https://steamcommunity.com/profiles/{:d}/edit/'.format(wa.steam_id),
                       files={'json': (None, 1)},  # forces multi-part encoding
                       data={
                         'sessionID': a.session_id,
                         'type': 'profileSave',
                         'personaName': 'PinkComodo',
                         'real_name': 'John Smith',
                         'customURL': '',
                         'summary': 'line1\nline2\nline3\nšŸ”„šŸ”„šŸ”„',
                         'country': 'US',
                         'state': 'CA',
                         'city': 239,  # Fairfield
                         'hide_profile_awards': 1,
                       })

print(resp.json())
# {'success': 1, 'errmsg': ''}

https://steamcommunity.com//actions/QueryLocations/ - Gives you countries, and CC https://steamcommunity.com//actions/QueryLocations/US/ - Gives you states https://steamcommunity.com//actions/QueryLocations/US/CO - Gives you cities and their cityid

OliverTrust commented 3 years ago

@rossengeorgiev. awesome! Thank you! The only thing left is to change the avatar...

rossengeorgiev commented 3 years ago

Setting avatar: https://github.com/ValvePython/steam/pull/290/files#diff-c5dcf5183586df09601971f83d3f028443ed37da81bb01170cf1a6b0de0ea9caR36-R58

OliverTrust commented 3 years ago

Try this way, but can't upload avatar. All time 'success': False

avatar = open('1.png', 'rb')
wa = WebAuth(username='login')
wa.cli_login(password='password')
set_avatat_resp = wa.session.post('https://steamcommunity.com/actions/FileUploader/',
                                  timeout=15,
                                  data={
                                      'type': 'player_avatar_image',
                                       'sId': wa.steam_id,
                                       'sessionid': wa.session_id,
                                       'json': 1
                                   },
                                   files={'avatar': avatar}).json()

print(set_avatat_resp)
# {'success': False, 'images': [], 'hash': None, 'message': ''}
rossengeorgiev commented 3 years ago

You have to see what the browser sends exactly, and replicate the same request. Also, make sure the image is the correct size.