valvepython / csgo Goto Github PK
View Code? Open in Web Editor NEWπ« Python package for interacting with CS:GO Game Coordinator
Home Page: http://csgo.readthedocs.io
π« Python package for interacting with CS:GO Game Coordinator
Home Page: http://csgo.readthedocs.io
hi, i ahve a problem when login i got :
Fatal Python error: ffi.from_handle() detected that the address passed points to garbage. If it is really the result of ffi.new_handle(), then the Python object has already been garbage collected Python runtime state: initialized
from steam.client import SteamClient
from csgo.client import CSGOClient
import logging
logon_details = {
'username': "unshibasauvage",
'password': "pass",
}
logging.basicConfig(format='[%(asctime)s] %(levelname)s %(name)s: %(message)s', level=logging.DEBUG)
client = SteamClient()
client.login(logon_details)
cs = CSGOClient(client)
@client.on('logged_on')
def start_csgo():
cs.launch()
@cs.on('ready')
def gc_ready():
# send messages to gc
pass
client.cli_login()
C:\Users\Shibo\AppData\Local\Programs\Python\Python38\python.exe D:/Documents/Project/CsgoSkinScreenshot---CSS/test.py
[2020-05-11 21:47:04,036] DEBUG SteamClient: Attempting login
[2020-05-11 21:47:04,036] DEBUG SteamClient: Connect initiated.
[2020-05-11 21:47:04,036] DEBUG CMServerList: Attempting bootstrap via WebAPI
[2020-05-11 21:47:04,039] DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): api.steampowered.com:443
[2020-05-11 21:47:04,316] DEBUG urllib3.connectionpool: https://api.steampowered.com:443 "GET /ISteamDirectory/GetCMList/v1/?cellid=0&format=json HTTP/1.1" 200 793
[2020-05-11 21:47:04,317] DEBUG CMServerList: Recieved 100 servers from WebAPI
[2020-05-11 21:47:04,317] DEBUG CMServerList: Added 100 new CM addresses.
[2020-05-11 21:47:04,318] DEBUG Connection: Attempting connection to ('155.133.248.34', 27020)
[2020-05-11 21:47:04,335] DEBUG Connection: Connected.
[2020-05-11 21:47:04,335] DEBUG SteamClient: Emit event: 'connected'
[2020-05-11 21:47:04,351] DEBUG SteamClient: Incoming: <Msg(<EMsg.ChannelEncryptRequest: 1303> | ChannelEncryptRequest)>
[2020-05-11 21:47:04,351] DEBUG SteamClient: Emit event: <EMsg.ChannelEncryptRequest: 1303>
[2020-05-11 21:47:04,351] DEBUG SteamClient: Securing channel
[2020-05-11 21:47:04,354] DEBUG SteamClient: Outgoing: <Msg(<EMsg.ChannelEncryptResponse: 1304> | ChannelEncryptResponse)>
Fatal Python error: ffi.from_handle() detected that the address passed points to garbage. If it is really the result of ffi.new_handle(), then the Python object has already been garbage collected
Python runtime state: initialized
Thread 0x00004098 (most recent call first):
File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent_threading.py", line 60 in wait
File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent_threading.py", line 146 in get
File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\threadpool.py", line 155 in run
Current thread 0x00004ef0 (most recent call first):
File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent_ffi\loop.py", line 264 in python_stop
File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\libuv\loop.py", line 498 in __run_queued_callbacks
File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\libuv\loop.py", line 218 in _run_callbacks
File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent_ffi\loop.py", line 300 in python_prepare_callback
File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\libuv\loop.py", line 542 in run
File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\hub.py", line 618 in run
Process finished with exit code -1073740791 (0xC0000409)
python : Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
os : windows 10
thx for help :)
Hi! Im not sure, but want to know your opinion, is it legit to use this? Have you done any researches about valve rules?
First things first, thanks for fixing the issue that i post about 2 hours ago quickly. I have another issue, the title says everything.
Code:
from steam import SteamClient
from steam import SteamID
from csgo import CSGOClient
client = SteamClient()
cs = CSGOClient(client)
@client.on('logged_on')
def start_csgo():
cs.launch()
@cs.on('ready')
def gc_ready():
print(cs.request_recent_user_games('76561198267687927'))
pass
client.cli_login('hidden', 'hidden')
client.run_forever()
Output:
Traceback (most recent call last):
File "src\gevent\greenlet.py", line 766, in gevent._greenlet.Greenlet.run
File "C:/Users/moros/Desktop/python/bot.py", line 16, in gc_ready
print(cs.request_recent_user_games(76561198267687927))
File "C:\Users\moros\AppData\Local\Programs\Python\Python37-32\lib\site-packages\csgo\features\match.py", line 91, in request_recent_user_games
'accountid': account_id,
File "C:\Users\moros\AppData\Local\Programs\Python\Python37-32\lib\site-packages\csgo\client.py", line 179, in send
self._send(emsg, data, proto)
File "C:\Users\moros\AppData\Local\Programs\Python\Python37-32\lib\site-packages\csgo\client.py", line 192, in _send
proto_fill_from_dict(message, data)
File "C:\Users\moros\AppData\Local\Programs\Python\Python37-32\lib\site-packages\steam\util\__init__.py", line 137, in proto_fill_from_dict
setattr(message, key, val)
ValueError: Value out of range: 76561198267687927
2019-07-10T21:49:26Z <Greenlet at 0x516f780: gc_ready> failed with ValueError
Edit: Same happens with "request_live_game_for_user()"
I'm getting this error when i try to run my program.
from steam import SteamClient
from csgo import CSGOClient
client = SteamClient()
cs = CSGOClient(client)
client.cli_login()
client.run_forever()
@cs.on('ready')
def gc_ready():
print("Game coordinator is now ready!")
@cs.on('notready')
def gc_notready():
print("Lost connection to Game Coordinator!")
Traceback (most recent call last):
File "mmrank.py", line 5, in
cs = CSGOClient(client)
File "/usr/local/lib/python2.7/dist-packages/csgo/init.py", line 11, in new
from csgo.client import CSGOClient as CSC
File "/usr/local/lib/python2.7/dist-packages/csgo/client.py", line 13, in
from csgo.features import FeatureBase
File "/usr/local/lib/python2.7/dist-packages/csgo/features/init.py", line 1, in
from csgo.features.match import Match
File "/usr/local/lib/python2.7/dist-packages/csgo/features/match.py", line 1, in
from csgo.enums import ECsgoGCMsg
File "/usr/local/lib/python2.7/dist-packages/csgo/enums.py", line 20, in
_proto_module = import("csgo.protobufs", globals(), locals(), _proto_modules, _level)
File "/usr/local/lib/python2.7/dist-packages/csgo/protobufs/gcsdk_gcmessages_pb2.py", line 17, in
import csgo.protobufs.steammessages_pb2 as steammessages__pb2
File "/usr/local/lib/python2.7/dist-packages/csgo/protobufs/steammessages_pb2.py", line 26, in
dependencies=[google_dot_protobuf_dot_descriptor__pb2.DESCRIPTOR,])
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/descriptor.py", line 824, in new
return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "steammessages.proto":
CMsgProtoBufHeader.target_job_name: "CMsgProtoBufHeader.target_job_name" is already defined in file "steammessages_base.proto".
CMsgProtoBufHeader.eresult: "CMsgProtoBufHeader.eresult" is already defined in file "steammessages_base.proto".
CMsgProtoBufHeader.error_message: "CMsgProtoBufHeader.error_message" is already defined in file "steammessages_base.proto".
CMsgProtoBufHeader: "CMsgProtoBufHeader" is already defined in file "steammessages_base.proto".
msgpool_soft_limit: "msgpool_soft_limit" is already defined in file "steammessages_base.proto".
msgpool_hard_limit: "msgpool_hard_limit" is already defined in file "steammessages_base.proto".
Getting this error when creating a new Match object by calling match.Match()
Full stacktrace:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/gevent/greenlet.py", line 536, in run
result = self._run(*self.args, **self.kwargs)
File "abc.py", line 36, in gc_ready
sengMsg()
File "abc.py", line 14, in sengMsg
matchObj = match.Match()
File "/usr/local/lib/python3.5/site-packages/csgo/features/match.py", line 8, in __init__
self.on(ECsgoGCMsg.EMsgGCCStrike15_v2_MatchmakingGC2ClientHello, self.__handle_mmstats)
AttributeError: 'Match' object has no attribute 'on'
How could I fetch items that can currently be bought from the in-game shop?
New ranks was introduced and I see you haven't added support for it.
Hi guys. i have a couple questions.
First. when I inspect the item's paintwear, it's an integer. Why? in game, this is a float value.
example
inspect_params = {'param_a': 15145586192, 'param_d': 16595344889481721483, 'param_s': 76561198282463169}
cs.send(ECsgoGCMsg.EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockRequest, inspect_params)
response = cs.wait_event(ECsgoGCMsg.EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockResponse, timeout=10)
{
itemid: 15145586192
defindex: 9
paintindex: 279
rarity: 6
quality: 4
**paintwear: 1049016027**
paintseed: 492
stickers {
slot: 3
sticker_id: 3171
}
inventory: 51
origin: 4
}
Second. is it possible to send a list of items to the server and get a response with the data of all the items instead of doing it one by one? more or less like this:
cs.send( ECsgoGCMsg.EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockRequest,
[
'itemLink1',
'itemLink2',
'itemLinkN',
] )
Hey,
for now three days request_live_game_for_user()
is no longer returning any match data nor emitting a live_game_for_user
event.
Not sure if it's connected but it stopped working after the newest csgo update on january the 7th, 2021...
request_current_live_games()
however is still working as expected and emitting current_live_games
after it is done.
Sadly i am quite new to python so i can't go in to much more detail execpt for adding the verbose_debug log and the code i used.
client = SteamClient()
cs = CSGOClient(client)
cs.verbose_debug = True
steam_id = 76561197979035432
@client.on('logged_on')
def start_csgo():
print('Logged in to Steam')
cs.launch()
print('CS:GO game coordinator starting')
@cs.on('ready')
def gc_ready():
print(f'{current_time()} - CS:GO game coordinator running')
cs.request_live_game_for_user(to_account_id(steam_id))
r = cs.wait_event('live_game_for_user', timeout=30, raises=False)
print(f'{current_time()} - request_live_game_for_user returned "{r}"')
if r is None:
cs.exit()
client.logout()
client.cli_login(username=credentials.username, password=credentials.password)
client.run_forever()
the Output:
2021-01-10T17:55:50.348275 - CS:GO game coordinator running
[2021-01-10 17:55:50,348] DEBUG CSGOClient: Incoming: <ECsgoGCMsg.EMsgGCCStrike15_v2_MatchmakingGC2ClientHello: 9110>
msg: 9110
headerLength: 0
---------
account_id: 294389456
global_stats {
players_online: 918109
servers_online: 236997
players_searching: 42984
servers_available: 103482
ongoing_matches: 39172
search_time_avg: 145175
search_statistics {
game_type: 520
players_searching: 15636
}
search_statistics {
game_type: 32776
players_searching: 19969
main_post_url: ""
required_appid_version: 13776
pricesheet_version: 1609999596
twitch_streams_version: 2
active_tournament_eventid: 16
active_survey_id: 0
}
vac_banned: 0
commendation {
cmd_friendly: 3
cmd_teaching: 3
cmd_leader: 7
}
player_level: 25
player_cur_xp: 327682533
[2021-01-10 17:55:50,348] DEBUG CSGOClient: Emit event: <ECsgoGCMsg.EMsgGCCStrike15_v2_MatchmakingGC2ClientHello: 9110>
[2021-01-10 17:55:50,348] DEBUG CSGOClient: Outgoing: <ECsgoGCMsg.EMsgGCCStrike15_v2_MatchListRequestLiveGameForUser: 9154>
-- header ---------
msg: 9154
headerLength: 0
-- message --------
accountid: 18769704
[2021-01-10 17:55:50,348] DEBUG SteamClient: Outgoing: <MsgProto(<EMsg.ClientToGC: 5452> | CMsgGCClient)>
[2021-01-10 17:55:50,348] DEBUG CSGOClient: Emit event: 'matchmaking_stats'
[2021-01-10 17:55:50,382] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2021-01-10 17:55:50,383] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2021-01-10 17:55:50,383] DEBUG SteamClient: Multi: Unpacking
[2021-01-10 17:55:50,383] DEBUG SteamClient: Multi: Decompressing payload (341 -> 433)
[2021-01-10 17:55:50,383] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientFromGC: 5453> | CMsgGCClient)>
[2021-01-10 17:55:50,383] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2021-01-10 17:55:50,383] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientFromGC: 5453> | CMsgGCClient)>
[2021-01-10 17:55:50,383] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2021-01-10 17:55:50,384] DEBUG CSGOClient: Incoming: <ECsgoGCMsg.EMsgGCCStrike15_v2_GC2ClientGlobalStats: 9173>
msg: 9173
headerLength: 0
---------
search_statistics {
game_type: 520
search_time_avg: 333985
}
rtime32_cur: 1610297750
[2021-01-10 17:55:50,384] DEBUG CSGOClient: Emit event: <ECsgoGCMsg.EMsgGCCStrike15_v2_GC2ClientGlobalStats: 9173>
[2021-01-10 17:55:50,384] DEBUG CSGOClient: Incoming: <ECsgoGCMsg.EMsgGCCStrike15_v2_ClientGCRankUpdate: 9194>
msg: 9194
headerLength: 0
---------
rankings {
account_id: 294389456
rank_id: 0
wins: 347
rank_type_id: 6
}
[2021-01-10 17:55:50,384] DEBUG CSGOClient: Emit event: <ECsgoGCMsg.EMsgGCCStrike15_v2_ClientGCRankUpdate: 9194>
[2021-01-10 17:55:52,281] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2021-01-10 17:55:52,281] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2021-01-10 17:55:52,281] DEBUG SteamClient: Multi: Unpacking
[2021-01-10 17:55:52,281] DEBUG SteamClient: Multi: Decompressing payload (243 -> 325)
[2021-01-10 17:55:52,281] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientIsLimitedAccount: 5430> | not parsed)>
[2021-01-10 17:55:52,281] DEBUG SteamClient: Emit event: <EMsg.ClientIsLimitedAccount: 5430>
[2021-01-10 17:55:52,281] DEBUG SteamClient: Incoming: <Msg(<EMsg.ClientMarketingMessageUpdate2: 5510> | not parsed)>
[2021-01-10 17:55:52,281] DEBUG SteamClient: Emit event: <EMsg.ClientMarketingMessageUpdate2: 5510>
[2021-01-10 17:55:53,843] DEBUG SteamClient: Outgoing: <MsgProto(<EMsg.ClientHeartBeat: 703> | CMsgClientHeartBeat)>
[2021-01-10 17:56:02,855] DEBUG SteamClient: Outgoing: <MsgProto(<EMsg.ClientHeartBeat: 703> | CMsgClientHeartBeat)>
[2021-01-10 17:56:08,180] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2021-01-10 17:56:08,180] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2021-01-10 17:56:08,180] DEBUG SteamClient: Multi: Unpacking
[2021-01-10 17:56:08,180] DEBUG SteamClient: Multi: Decompressing payload (536 -> 735)
[2021-01-10 17:56:08,180] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientPersonaState: 766> | CMsgClientPersonaState)>
[2021-01-10 17:56:08,180] DEBUG SteamClient: Emit event: <EMsg.ClientPersonaState: 766>
[2021-01-10 17:56:11,865] DEBUG SteamClient: Outgoing: <MsgProto(<EMsg.ClientHeartBeat: 703> | CMsgClientHeartBeat)>
[2021-01-10 17:56:18,181] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2021-01-10 17:56:18,181] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2021-01-10 17:56:18,181] DEBUG SteamClient: Multi: Unpacking
[2021-01-10 17:56:18,181] DEBUG SteamClient: Multi: Decompressing payload (537 -> 735)
[2021-01-10 17:56:18,182] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientPersonaState: 766> | CMsgClientPersonaState)>
[2021-01-10 17:56:18,182] DEBUG SteamClient: Emit event: <EMsg.ClientPersonaState: 766>
[2021-01-10 17:56:20,349] DEBUG SteamClient: Outgoing: <MsgProto(<EMsg.ClientGamesPlayed: 742> | CMsgClientGamesPlayed)>
[2021-01-10 17:56:20,349] DEBUG CSGOClient: Emit event: 'connection_status'
[2021-01-10 17:56:20,349] DEBUG CSGOClient: Emit event: 'notready'
[2021-01-10 17:56:20,349] DEBUG SteamClient: Outgoing: <MsgProto(<EMsg.ClientLogOff: 706> | CMsgClientLogOff)>
2021-01-10T17:56:20.349377 - request_live_game_for_user returned "None"
[2021-01-10 17:56:20,472] DEBUG Connection: Connection error (reader).
[2021-01-10 17:56:20,472] DEBUG Connection: Disconnected.
[2021-01-10 17:56:20,472] DEBUG SteamClient: Emit event: 'disconnected'
I hope this issuse is resolvable.
BTW everybody has this proble currently: csgostats.gg and csgorunner.com both currently have the same issue of not being able to get live match data
https://github.com/ValvePython/csgo/blob/master/csgo/common_enums.py. how can I use
class EXPFlag(IntEnum):
UNKNOWN1 = 0b0000000000000000000000000000001
LevelUpDropReceived = 0b0000000000000000000000000000010
UNKNOWN2 = 0b0000000000000000000000000010000 # OW or Prime status
OverwatchXPReward = 0b0010000000000000000000000000000
WeeklyXPBoostReceived = 0b0100000000000000000000000000000
UNKNOWN3 = 0b1000000000000000000000000000000 # OW related?
the above class for cs.account_id. Can u show an implementation to get WeeklyXPBoostReceived or not, how to check?
When I request for item's float and such, it says custom_name is "", even though it is not. Why?
Hello. Need help, please guys :) There are 2 questions that i dont understand.
I use
response = cs.wait_event('full_match_info', timeout=30, raises=False)
for get the game data from user last match. But whats the format i getting on response?
I tried to use str(response[0])
and next decode by json.loads()
, but i get an json decode error.
How can i decode this data to dict or something like that??? (wrote down)
How the sites like csgostats.gg and other get the all info about match?
like flashes, flash assists, jumpshots, the accuracy with AK-47, grenade damage etc. I can get only kill, assists, headshots and score (very little info) via cs.request_full_match_info()
. Is it possible to get more data via that python module?
The response data i want to decode or something like that:
msgrequestid: 9147
accountid: 1185931041
servertime: 1614835709
matches {
matchid: 3467736107796398755
matchtime: 1614790460
watchablematchinfo {
server_ip: 181
tv_port: 1806964191
tv_spectators: 0
cl_decryptdata_key_pub: 8411663965113195703
}
roundstatsall {
reservation {
account_ids: 325391327
account_ids: 55022319
account_ids: 199873381
account_ids: 92583876
account_ids: 97254842
account_ids: 354762908
account_ids: 138651512
account_ids: 841090319
account_ids: 183710739
account_ids: 119649041
}
etc
Hey,
I am currently working on this functionality of retrieving CSOEconGameAccountClient in my C# library and can't figure out how CSOEconGameAccountClient is received.
If I understood correctly the coordinator sends the message k_ESOMsg_Update(22)
or k_ESOMsg_UpdateMultiple(26)
then this message is parsed and the types are checked based on the cs.socache.ESOType
if this type equals cs.socache.ESOType.CSOEconGameAccountClient
then the proto CSOEconGameAccountClient
is parsed.
I am currently now understanding where this payload and type is located.
Would it be possible that you guys could give me a brief overview how I would intercept the CSOEconGameAccountClient
message ?
My understanding is that after the player played a game or logs in the k_ESOMsg_
are send where one contains the CSOEconGameAccountClient
message but none if the protos contains the CSOEconGameAccountClient
as a field so I am currently not sure how u are obtaining it.
Regards Artur
Hi, I am trying to get the EMsg.ClientRichPresenceInfo
. However I think this info is sent out without sending something else prior.
A function with
@cs.on('EMsg.ClientRichPresenceInfo')
def test(p)
print(p)
does not seem to work. Can someone point me in the right direction?
I made a simple autoreg, after creating an account, I want idle hours in csgo, but a simple cs.launch () is not enough, hours are not added. So, my question is "How to add CS:GO to steam library."
I tried many ways to get "cs.wait_event('item_data_block', 1)" but I don't know.
My code:
client = SteamClient()
client.cli_login('', '')
cs = CSGOClient(client)
cs.launch()
cs.request_preview_data_block(s=76561198390812765, a=11899154096, d=14908795644343063777, m=0)
response = cs.wait_event('item_data_block', 1)
print(response)
Answer:
C:\Users\Vanya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\gevent\monkey.py:776: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See gevent/gevent#1016. Modules that had direct imports (NOT patched): ['urllib3.contrib.pyopenssl (C:\Users\Vanya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\contrib\pyopenssl.py)'].
_queue_warning(
None
Help me pls.
Hello @rossengeorgiev
I am actively using your package, mostly for checking float of the guns.
And I am interested how safety it is.
For example, I have single account and make ~30 requests per minute.
May steam regard that it's malicious activity or something similar?
May I be banned and how can I protect myself?
Thank you
The response comes as bytes. How do I decode it?
I'd like to know where can I find the stuff that I need to pass in as parameters for different messages. For example:
message CGCSystemMsg_GetAccountDetails {
option (msgpool_soft_limit) = 128;
option (msgpool_hard_limit) = 512;
optional fixed64 steamid = 1;
optional uint32 appid = 2;
}
I have no idea what goes into (msgpool_soft_limit) and (msgpool_hard_limit)
Hi,
I use CSGOClient to login,then I got a error log like it:
lib/python2.7/site-packages/csgo/client.py/[line:97] Failed to parse: 9194
I think msg 9194 mean:
EMsgGCCStrike15_v2_ClientGCRankUpdate = 9194
Code:
from steam import SteamClient
from csgo import CSGOClient
from csgo.enums import ECsgoGCMsg
steam_client = SteamClient()
steam_client.anonymous_login()
client = CSGOClient(steam_client)
client.launch()
client.send(
ECsgoGCMsg.EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockRequest,
data={
"s": 76561198390812765,
"a": 11899154096,
"d": 14908795644343063777
}
)
Traceback:
Traceback (most recent call last):
File "/home/yzinets/Projects/python-steam/run.py", line 15, in <module>
"d": 14908795644343063777
File "/usr/local/lib/python3.5/dist-packages/csgo/client.py", line 173, in send
self._send(emsg, data, proto)
File "/usr/local/lib/python3.5/dist-packages/csgo/client.py", line 186, in _send
proto_fill_from_dict(message, data)
File "/usr/local/lib/python3.5/dist-packages/steam/util/__init__.py", line 111, in proto_fill_from_dict
desc = field_descs[key]
KeyError: 'a'
I'm trying to find a user's most recent match so I can check whether it was a win or a loss. I'm very new when it comes to python, so trying to do this is a little over my skill level in this language. So far what I have is,
from steam.client import SteamClient
from csgo.client import CSGOClient
from csgo.enums import ECsgoGCMsg
#from google.protobuf.json_format import MessageToDict
#import logging
#logging.basicConfig(format='[%(asctime)s] %(levelname)s %(name)s: %(message)s', level=logging.DEBUG)
client = SteamClient()
cs = CSGOClient(client)
@client.on('logged_on')
def start_csgo():
cs.launch()
@cs.on('ready')
def gc_ready():
# send messages to gc
pass
client.cli_login()
client.run_forever()
cs.request_recent_user_games(XXXXXXXXXXXXX) #i put my user's steam id here
response, = cs.wait_event('recent_user_games')
print(str(response))
I'm currently just trying to retrieve the match list and print the most recent games, but no matter what I try I can't get it to print. Also, I'm unsure if I'm using the account_id correctly for cs.request_recent_user_games(). I'm also using the Steam Profile ID that you can find on your steam profile (17 numbers), but i don't know if I should be using something else. Does anyone know what I'm doing wrong here?
How can I completely remove a sticker from a weapon, i tried like this
client = SteamClient()
cs = CSGOClient(client)
@client.on('logged_on')
def start_csgo():
cs.launch()
@cs.on('ready')
def gc_ready():
cs.send(EGCItemCustomizationNotification.RemoveSticker, {
'item_id': 23911133513,
'sticker_slot': 3,
'sticker_wear': 1.0
})
client.cli_login(username, password)
client.run_forever()
but it doesn't work (
Can you show how to use this method?
https://csgo.readthedocs.io/en/stable/csgo.enums.html#csgo.proto_enums.EGCItemCustomizationNotification.RemoveSticker
Usage is not provided in docs.
Example:
import csgo.features.items
Items = csgo.features.items.Items()
res = Items.request_preview_data_block(s=76561198390812765, a=11899154096, d=14908795644343063777, m=0)
Not working
csgo/protobufs/gcsdk_gcmessages.proto
Line 170 in bf70a41
the program here :
http://csgo.readthedocs.io/en/stable/user_guide.html#initialization
error :
ImportError: cannot import name 'CSGOClient'
`
Hello !
I was wondering if csgo also had a game coordinator like dota 2 where one can create games / invite / kick players ?
Thanks :)
is there a way on how to get my GC in a community server i know that client.launch() just set main client app id to 730 which is for csgo but i can not find a way on how to join actual server
How do I replicate this so that I can set payload for steam.core.msg.Msg:
let payload = new ByteBuffer(12, ByteBuffer.LITTLE_ENDIAN);
payload.writeInt64(25523252);
payload.writeInt32(1);
Hi, I hope you're doing well.
I am trying to get the full match info using a match share code and I am fine all the way till decoding the share code (I understand it's basics :)). however, when I am trying the request_full_match_info, I am not getting any data (I tried with both cli_login and anonymous login). The debug logs are below (i am using Django and have included gevent in the manage.py file (correct me if I am wrong about this) and my goal is to fetch the demo URL from the match share code. I tried using send as well. Also, I tried the same in vanilla python with gevent etc in place. Same issue :(
could you give a small implementation because I am able to get the data of the following:
cs.request_player_profile(cs.account_id, request_level=32)
PlayerProfiledata = cs.wait_event('player_profile')
PlayerProfiledata[0].ranking.rank_id
ranks_map = {0: 'Unranked', 1: 'Silver I', 2: 'Silver II', 3: 'Silver III', 4: 'Silver IV',
5: 'Silver Elite',
6: 'Silver Elite Master', 7: 'Gold Nova I', 8: 'Gold Nova II', 9: 'Gold Nova III',
10: 'Gold Nova Master',
11: 'Master Guardian I', 12: 'Master Guardian II', 13: 'Master Guardian Elite',
14: 'Distinguished Master Guardian', 15: 'Legendary Eagle', 16: 'Legendary Eagle Master',
17: 'Supreme Master First Class', 18: 'The Global Elite'}
levels_map = {0: 'Not Recruited', 1: 'Recruit', 2: 'Private', 3: 'Private', 4: 'Private', 5: 'Corporal',
6: 'Corporal',
7: 'Corporal', 8: 'Corporal', 9: 'Sergeant', 10: 'Sergeant', 11: 'Sergeant',
12: 'Sergeant',
13: 'Master Sergeant', 14: 'Master Sergeant', 15: 'Master Sergeant',
16: 'Master Sergeant',
17: 'Sergeant Major', 18: 'Sergeant Major', 19: 'Sergeant Major', 20: 'Sergeant Major',
21: 'Lieutenant',
22: 'Lieutenant', 23: 'Lieutenant', 24: 'Lieutenant', 25: 'Captain', 26: 'Captain',
27: 'Captain',
28: 'Captain', 29: 'Major', 30: 'Major', 31: 'Major', 32: 'Major', 33: 'Colonel',
34: 'Colonel',
35: 'Colonel', 36: 'Brigadier General', 37: 'Major General', 38: 'Lieutenant General',
39: 'General',
40: 'Global General'}
ranks_map[PlayerProfiledata[0].ranking.rank_id]
but
EXPBonusFlag.BonusBoostConsumed.value or any other flags of class EXPBonuFlag always return their bitshift values.
Hi,
Are there known what represent which value?
I don't really know where it comes from, but it seems to be reproducable.
Unable to find key for 2
Unable to find key for 40
Unsupported type: 41
I could provide example credentials which generates this.
It seems to be connected with new Operation update.
im try start this code but im got error
CODE:
`from csgo import features
def get_float(self):
print(i.request_preview_data_block(s=0, a=19977124525, d=16898216808610796173, m=3298286890797738270))
if name == 'main':
i = features.Items()
get_float()`
ERROR:
self.on(ECsgoGCMsg.EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockResponse, self.__handle_preview_data_block)
AttributeError: 'Items' object has no attribute 'on'
I search requsts for buy in-game items, how connect to sockets and use this requests?
My code:
from steam import SteamClient
from csgo import CSGOClient
client = SteamClient()
cs = CSGOClient(client)
@client.on('logged_on')
def start_csgo():
cs.launch()
@cs.on('ready')
def gc_ready():
# send messages to gc
pass
client.cli_login('username', 'password')
client.run_forever()
Output:
MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.util.ssl_ (C:\\Users\\moros\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\urllib3\\util\\ssl_.py)', 'urllib3.util (C:\\Users\\moros\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\urllib3\\util\\__init__.py)'].
_warnings)
Traceback (most recent call last):
File "C:/Users/moros/Desktop/python/bot.py", line 5, in <module>
cs = CSGOClient(client)
File "C:\Users\moros\AppData\Local\Programs\Python\Python37-32\lib\site-packages\csgo\__init__.py", line 11, in __new__
from csgo.client import CSGOClient as CSC
File "C:\Users\moros\AppData\Local\Programs\Python\Python37-32\lib\site-packages\csgo\client.py", line 15, in <module>
from csgo.msg import get_emsg_enum, find_proto
File "C:\Users\moros\AppData\Local\Programs\Python\Python37-32\lib\site-packages\csgo\msg.py", line 75, in <module>
ECsgoGCMsg.EMsgGCCStrike15_v2_SetMyMedalsInfo: cstrike15_gcmessages_pb2.PlayerMedalsInfo,
File "C:\Users\moros\AppData\Local\Programs\Python\Python37-32\lib\enum.py", line 349, in __getattr__
raise AttributeError(name) from None
AttributeError: EMsgGCCStrike15_v2_SetMyMedalsInfo
I'm trying to send a request off as a job, but when I try to wait on the job id, it just blocks until the timeout expires yielding a None response. I've used the player profile request as an example here in the below reproducer. Changing the job id to 'player_profile' works and returns a profile, however this isn't suitable for my application as I need to be able to forward the correct response back to the original requester, and there may be many requesters at the same time. Am I doing this incorrectly, or is this unexpected behaviour? I've posted a reproducer below.
Thanks
from steam import SteamClient
from csgo import CSGOClient
from csgo.enums import ECsgoGCMsg
client = SteamClient()
cs = CSGOClient(client)
@client.on('logged_on')
def start_csgo():
cs.launch()
@cs.on('ready')
def ready(*args, **kwargs):
jobid = cs.send_job(ECsgoGCMsg.EMsgGCCStrike15_v2_ClientRequestPlayersProfile, {
'account_id': cs.account_id,
'request_level': 32,
})
resp = cs.wait_msg(jobid, timeout=10)
print(resp)
client.login(username='yourusername', password='yourpassword')
client.run_forever()
The code that I am having issues with can be seen here, specifically in this file on this line.
To reproduce the issue I am having, simply run the code I have provided, wait a few minutes without sending any requests (not sure how long specifically), then try to send a request. (Please read the readme on the repo I have linked, it explains how to run and use the code.) The script will try to call the method 3 times and receive None
each time.
It can be noted that I have set the timeout
to be only 1 second, but this issue persists no matter how long I set this interval to be.
I don't think this is rate limiting. If I run the code and make a lot of calls quickly, it works for a few calls before beginning to fail as expected due to rate limiting. The issue I have described though can occur as early as the first call if the first call is made after waiting a few minutes.
Hello, I have all info like steam_id, auth-key, share_code. When i get dict with all match_info, there are only account_id's. Who can i correspond account_id and some other info to identify user? Probably i should use some methods?
I wonder if there any way to get info about stickers on item? (Sticker name and float)
How can I get information about victories in mm, xp and my friend's rank
I used the api to get my recent game data like the following:
cs.request_recent_user_games(cs.account_id)
response = cs.wait_event('recent_user_games')
However, the data being returned is not correct (i.e. doesn't match the data in game). More specifically, only the account_ids seem to match the actual data. Kills, deaths, etc. all seem to be random numbers. What am I doing wrong here?
How on earth do I send steam.enums.emsg.EMsg.ClientMicroTxnAuthorize?
Hello you library can buy item in csgo? Example buy keys in csgo? if yes how to do it?
Thanks
from steam.client import SteamClient
from csgo.client import CSGOClient
client = SteamClient()
cs = CSGOClient(client)
client.cli_login(username="***", password="***")
print("[Steam] Logged on as: %s" % client.user.name)
print("[Steam] Community profile: %s" % client.steam_id.community_url)
print("[Steam] Last logon: %s" % client.user.last_logon)
print("[Steam] Last logoff: %s" % client.user.last_logoff)
print("[Steam] Number of friends: %d" % len(client.friends))
cs.launch()
print("[CS-GO] info: %s" % cs.ready)
inspect_params = {'param_a': 15145586192, 'param_d': 16595344889481721483, 'param_s': 76561198282463169}
cs.send(ECsgoGCMsg.EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockRequest, inspect_params)
response = cs.wait_event(ECsgoGCMsg.EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockResponse, timeout=10)
print("[CS-GO] response: %s" % response)
client.logout()
terminal print:
[Steam] Logged on as: ******
[Steam] Community profile: https://steamcommunity.com/profiles/***********
[Steam] Last logon: 2022-03-02 08:33:48
[Steam] Last logoff: 2022-03-02 08:31:52
[Steam] Number of friends: 0
[CS-GO] info: False
[CS-GO] response: None
I meet some trouble that I get nothing from client callbcak before timeout when I send message to CSGO client.
I need help! guys
i am trying to fetch the item_data_block of an item in my inventory
what i am trying:
`@cs.on('ready')
def gc_ready():
cs.request_preview_data_block(76561198135880269, 9047986951, 16351671827548572774, 0)
ds,=cs.wait_event('item_data_block')
print ds
`
my error
`
Traceback (most recent call last):
File "/Users/sargungulati/Desktop/pricebaap/main/lib/python2.7/site-packages/gevent/greenlet.py", line 536, in run
result = self._run(*self.args, **self.kwargs)
File "csrr.py", line 28, in gc_ready
cs.request_preview_data_block(76561198135880269, 9047986951, 16351671827548572774, 0)
File "/Users/sargungulati/Desktop/pricebaap/main/lib/python2.7/site-packages/csgo/features/items.py", line 42, in request_preview_data_block
'm': m,
File "/Users/sargungulati/Desktop/pricebaap/main/lib/python2.7/site-packages/csgo/client.py", line 173, in send
self._send(emsg, data, proto)
File "/Users/sargungulati/Desktop/pricebaap/main/lib/python2.7/site-packages/csgo/client.py", line 186, in _send
proto_fill_from_dict(message, data)
File "/Users/sargungulati/Desktop/pricebaap/main/lib/python2.7/site-packages/steam/util/init.py", line 111, in proto_fill_from_dict
desc = field_descs[key]
KeyError: 'a'
Sat Feb 11 16:38:55 2017 <Greenlet at 0x10919d4b0: gc_ready> failed with KeyError
`
During Tuesday's routine maintenance I discovered that the client does not automatically reconnect to the GC after having been disconnected. This was not unexpected, however it is not immediate clear how to detect this event and attempt a reconnection.
My first thought was to borrow the steam
lib's recipe for persistent login, with hope that including this in my project would also provide persistent connection to CS:GO (given that I call csgo
's launch()
on the steam
client's logged_on
event).
Can someone confirm whether this is correct, or if not provide the correct approach to reconnect?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.