Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make offer #406

Open
gradinazz opened this issue Aug 26, 2024 · 0 comments
Open

Make offer #406

gradinazz opened this issue Aug 26, 2024 · 0 comments

Comments

@gradinazz
Copy link

from steampy.client import SteamClient, Asset
from steampy.utils import GameOptions

Предоставленные данные

api_key = ''
username = ''
password = ''
steamguard_path = 'Steamguard.txt' # Путь к файлу Steamguard.txt
partner_id = "" # ID трейд-партнера
sending_item_id = '' # ID отправляемого предмета
game = GameOptions.CS # Используем GameOptions для CS:GO

Инициализируем клиент Steam

steam_client = SteamClient(api_key)

try:
# Логинимся в Steam с использованием файла Steamguard.txt
steam_client.login(username, password, steamguard_path)
print("Успешная авторизация в Steam")

# Создаем объект Asset для отправляемого предмета
my_asset = Asset(asset_id=sending_item_id, game=game)

# Отправляем трейд-офер
offer_result = steam_client.make_offer([my_asset], [], partner_id, "Test offer")

if 'tradeofferid' in offer_result:
    print(f"Трейд-офер успешно отправлен. ID: {offer_result['tradeofferid']}")
else:
    print(f"Ошибка при создании трейд-офера: {offer_result}")

except Exception as e:
print(f"Произошла ошибка: {e}")

finally:
try:
steam_client.logout()
print("Выход из аккаунта Steam.")
except Exception:
print("Не удалось выйти: пользователь не был авторизован.")

Успешная авторизация в Steam
Произошла ошибка: 'NoneType' object has no attribute 'get'
Выход из аккаунта Steam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@gradinazz and others