MIT License

项目介绍

sometastycake/pysteamauth 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 55 个 Star、10 次 Fork。

仓库全名
sometastycake/pysteamauth
开源许可证
MIT License
Star 数
55
Fork 数
10
未关闭 Issue
4

README 摘要

Asynchronous python library for Steam authorization using protobuf Install Usage If account have Steam Guard Cookie storage Library uses default cookie storage BaseCookieStorage, which stores Steam cookies in application memory. But you can write own cookie storage. For example, redis storage: Error processing Or Output {'error': 'InvalidPassword', 'code': 5} Proto files…

完整内容见 GitHub 原始 README 或本页 。

常见问题

pysteamauth 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 55 个 Star。

pysteamauth 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 pysteamauth 的源码?

可以直接克隆仓库:git clone https://github.com/sometastycake/pysteamauth.git,默认分支为 master;安装与运行步骤见仓库 README。

pysteamauth 最近还在维护吗?

仓库最近一次更新为 2025年2月13日,当前有 4 个未关闭 Issue;Star 数为 55,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Steam authorization using protobuf

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
78
价值分
36
活跃状态
活跃

语言占比

Python

Release

README

Asynchronous python library for Steam authorization using protobuf

pypi: package Python: versions

Install

pip install pysteamauth

Usage

from pysteamauth.auth import Steam


async def main():
    steam = Steam(
        login='login', 
        password='password',
    )
    
    await steam.login_to_steam()

    await steam.request('https://steamcommunity.com')
    await steam.request('https://store.steampowered.com')
    await steam.request('https://help.steampowered.com')

If account have Steam Guard

from pysteamauth.auth import Steam

steam = Steam(
    login='login',
    password='password',
    shared_secret='shared_secret',
)

Library uses default cookie storage BaseCookieStorage, which stores Steam cookies in application memory. But you can write own cookie storage. For example, redis storage:

import json
from typing import Dict

from aioredis import Redis
from pysteamauth.abstract import CookieStorageAbstract
from pysteamauth.auth import Steam


class RedisStorage(CookieStorageAbstract):

    redis = Redis()

    async def set(self, login: str, cookies: Dict) -> None:
        await self.redis.set(login, json.dumps(cookies))

    async def get(self, login: str, domain: str) -> Dict:
        cookies = await self.redis.get(login)
        if not cookies:
            return {}
        return json.loads(cookies).get(domain, {})


async def main():
    steam = Steam(
        login='login',
        password='password',
        cookie_storage=RedisStorage(),
    )
    
    await steam.login_to_steam()

Error processing

from pysteamauth.auth import Steam
from pysteamauth.errors import SteamError


async def main():
    try:
        await Steam('login', 'password').login_to_steam()
    except SteamError as error:
        print(error)
Or
from pysteamauth.auth import Steam
from pysteamauth.errors import SteamError, custom_error_exception


class LoginError(SteamError):
    ...


class RateLimitExceeded(SteamError):
    ...


custom_error_exception({
    5: LoginError,
    84: RateLimitExceeded,
})


async def main():
    try:
        await Steam('login', 'password').login_to_steam()
    except LoginError as error:
        print(error)
Output

{'error': 'InvalidPassword', 'code': 5}

Proto files

License

MIT

评论

暂无评论