semvec/pypi-packages huggingface dataset:
pysteamlib 1.0.1
Python Steam library
License: MIT
Requires Python: >=3.9

# Asynchronous python library for work with Steam

[![pypi: package](https://img.shields.io/badge/pypi-1.0.1-blue)](https://pypi.org/project/pysteamlib/)
[![Python: versions](
https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)]()


## Install

```bash
pip install pysteamlib
```

## Usage


### Getting started

```python
from pysteamauth.auth import Steam
from steamlib.api import SteamAPI

steam = Steam(
    login='login',
    password='password',
    shared_secret='shared_secret',
    identity_secret='identity_secret',
    device_id='device_id',
)
await steam.login_to_steam()
api = SteamAPI(steam)
```

### Account API

```python
from steamlib.api import SteamAPI
from steamlib.api.account import PrivacyInfo
from steamlib.api.account.schemas import ProfileInfo

async def usage(api: SteamAPI):

    # Get current tradelink
    current_tradelink: str = await api.account.get_tradelink()
    
    # Register new tradelink
    new_tradelink: str = await api.account.register_tradelink()
    
    # Privacy settings
    privacy_settings: PrivacyInfo = await api.account.get_current_privacy()
    
    # Get profile info
    profile_info: ProfileInfo = await api.account.get_current_profile_info()
    
    # Register api key
    api_key: str = await api.account.register_api_key('example.com')
```

### Trade API

```python
from steamlib.api import SteamAPI
from steamlib.api.trade import Asset, JsonTradeoffer, SendOfferRequest


async def usage(api: SteamAPI):

    response = await api.trade.send_offer(
        request=SendOfferRequest(
            partner=steamid,
            tradelink='tradelink',
            me=[
                Asset(
                    appid='appid',
                    contextid='contextid',
                    amount=1,
                    assetid='assetid',
                ),
            ],
            them=[],
        ),
    )
    if error := response.get('strError'):
        print('Send offer error:', error)
        return
    tradeofferid = response['tradeofferid']
    await api.trade.mobile_confirm_by_creator_id(tradeofferid)
    await api.trade.cancel_offer(tradeofferid)
```

## License

MIT
pysteamauth 1.1.2
Asynchronous python library for Steam authorization using protobuf
License: MIT
Requires Python: >=3.9

# Asynchronous python library for Steam authorization using protobuf

[![pypi: package](https://img.shields.io/badge/pypi-1.1.2-blue)](https://pypi.org/project/pysteamauth/)
[![Python: versions](
https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)]()


## Install

```bash
pip install pysteamauth
```


## Usage

```python
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

```python
from pysteamauth.auth import Steam

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

## 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:

```python
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

```python
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

```python
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

- https://github.com/SteamDatabase/Protobufs/blob/master/steam/enums.proto
- https://github.com/SteamDatabase/Protobufs/blob/master/steam/steammessages_base.proto
- https://github.com/SteamDatabase/Protobufs/blob/master/steam/steammessages_auth.steamclient.proto
- https://github.com/SteamDatabase/Protobufs/blob/master/steam/steammessages_unified_base.steamclient.proto

## License

MIT
pydn2 0.0.6
Thin wrapper around libidn2
License: MIT
Requires Python: >=3.9
Keywords: libidn2, idn2, IDN2008

# pydn2

**pydn2** is a Python binding for [libidn2](https://libidn.gitlab.io/libidn2/), the GNU implementation of the Internationalized Domain Names (IDNA) protocol (IDNA2008/TR46). This extension enables you to perform various domain name conversions—such as converting between Unicode (U-label) and ASCII-compatible (A-label) representations—and supports the full public API of libidn2.

## Features

- **Conversion Functions**
  - Convert Unicode domain names to their ASCII (Punycode) equivalents.
  - Convert Punycode domains back to Unicode.
  - Perform lookup conversions for registration and DNS lookup.
- **Error Handling**
  - Retrieve human-readable error messages and error code names.
- **Compliance with IDNA2008/TR46**
  - Uses flags to control normalization and processing (e.g. NFC, transitional/non-transitional).

## Requirements

- **libidn2**
  Make sure [libidn2](https://www.gnu.org/software/libidn/libidn2/manual/libidn2.html) is installed on your system. On macOS with Homebrew, you can install it via:
  ```bash
  brew install libidn2
  ```
  On linux debian based system:
  ```bash
  sudo apt-get -y install libidn2-0 libidn2-dev
  ```
- A C compiler that supports building Python C extensions.
- Python 3.9–3.12 (and possibly newer versions if you update the CI matrix).

## Installation

```bash
pip install pydn2
```

## Usage

```python
import pydn2

# Convert a Unicode domain to its ASCII (Punycode) representation:
ascii_domain = pydn2.to_ascii_8z("bücher", 0)
print(ascii_domain)  # e.g., "xn--bcher-kva"

# Convert a Punycode domain back to Unicode:
unicode_domain = pydn2.to_unicode_8z8z("xn--bcher-kva", 0)
print(unicode_domain)  # e.g., "bücher"

# You can also use flags for additional processing:
ascii_domain_transitional = pydn2.to_ascii_8z("☮️.com", pydn2.IDN2_NFC_INPUT | pydn2.IDN2_TRANSITIONAL)
print(ascii_domain_transitional)
```

## Module Constants

The extension exposes several flag constants for controlling conversion behavior:
- IDN2_NFC_INPUT – Apply NFC normalization on input.
- IDN2_ALABEL_ROUNDTRIP – Apply additional round-trip conversion of A-label inputs.
- IDN2_TRANSITIONAL – Perform Unicode TR46 transitional processing.
- IDN2_NONTRANSITIONAL – Perform Unicode TR46 non-transitional processing (default).
- IDN2_NO_TR46 – Disable any TR46 transitional or non-transitional processing.
- IDN2_USE_STD3_ASCII_RULES – Use STD3 ASCII rules.


## Benchmark

| Method                    | Conversion Output | Single-thread Benchmark (sec, 1,000,000 iterations) | Multi-thread Benchmark (sec, 1,000,000 iterations) |
|---------------------------|-------------------|----------------------------------------------------:|---------------------------------------------------:|
| **pydn2 (IDNA2008/TR46)** | `xn--i-n3p.com`   |                                            1.170304 |                                           1.156370 |
| **builtin (IDNA2003)**    | `xn--i-n3p.com`   |                                            6.716825 |                                           6.674858 |