Metadata-Version: 2.1
Name: telegram-session-converter
Version: 0.1.1
Summary: A simple library for converting .session files from/to telethon or pyrogram format
Author: bundemshake
Author-email: bundemshake@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/markdown
Requires-Dist: telethon
Requires-Dist: pydantic

Here's a README.md for the "Session Converter" package based on the provided code:

---

# Session Converter

The **Session Converter** package provides a straightforward way to convert sessions between Pyrogram and Telethon, two popular Telegram API wrappers. This package supports converting both session files and string sessions between the two libraries.

## Features

- Convert **Pyrogram session files** to Telethon sessions.
- Convert **Pyrogram string sessions** to Telethon sessions.
- Convert **Telethon string sessions** to Pyrogram sessions.
- Convert **Telethon session files** to Pyrogram sessions.
- Handles both **API ID** and **DC ID**.

## Installation

```bash
pip install session-converter
```

## Usage

### Converting from Pyrogram Session File to Telethon Session

```python
from session_converter import SessionManager

# Provide the path to the Pyrogram session file
pyrogram_session_file = "path/to/pyrogram_session_file.session"

# Convert to Telethon session
session_manager = SessionManager.from_pyrogram_session_file(pyrogram_session_file)

# You can now access the converted session details
print(session_manager.session)
```

### Converting from Pyrogram String Session to Telethon Session

```python
from session_converter import SessionManager

# Provide the Pyrogram session string
pyrogram_session_string = "<your_pyrogram_session_string>"

# Convert to Telethon session
session_manager = SessionManager.from_pyrogram_string_session(pyrogram_session_string)

# Access the converted session details
print(session_manager.session)
```

### Converting from Telethon Session File to Pyrogram Session

```python
from session_converter import SessionManager

# Provide the path to the Telethon session file
telethon_session_file = "path/to/telethon_session_file.session"

# Convert to Pyrogram session
session_manager = SessionManager.from_telethon_file(telethon_session_file)

# Access the converted session details
print(session_manager.session)
```

### Converting from Telethon String Session to Pyrogram Session

```python
from session_converter import SessionManager

# Provide the Telethon session string
telethon_session_string = "<your_telethon_session_string>"

# Convert to Pyrogram session
session_manager = SessionManager.from_telethon_string_session(telethon_session_string)

# Access the converted session details
print(session_manager.session)
```

### Exporting Converted Sessions

You can also export the converted sessions back into files or string formats:

#### Export Pyrogram Session to File

```python
# Export the Pyrogram session to a file
file_path = session_manager.pyrogram_file("path/to/pyrogram_file.session")
```

#### Export Telethon Session to File

```python
# Export the Telethon session to a file
file_path = session_manager.telethon_file("path/to/telethon_file.session")
```

#### Export Pyrogram Session as String

```python
# Export the session as a Pyrogram string
pyrogram_session_string = session_manager.pyrogram_string_session()
print(pyrogram_session_string)
```

#### Export Telethon Session as String

```python
# Export the session as a Telethon string
telethon_session_string = session_manager.telethon_string_session()
print(telethon_session_string)
```

## Classes

### `SessionManager`

The main class for managing session conversions. Provides methods to convert between Pyrogram and Telethon sessions.

#### Methods:
- `from_pyrogram_session_file(file: str)`: Converts a Pyrogram session file to a Telethon session.
- `from_pyrogram_string_session(session_string: str)`: Converts a Pyrogram session string to a Telethon session.
- `from_telethon_string_session(session_string: str, do_login: bool = False)`: Converts a Telethon session string to a Pyrogram session.
- `from_telethon_file(file: str, do_login: bool = False)`: Converts a Telethon session file to a Pyrogram session.
- `pyrogram_file(file: str, **kwargs)`: Exports the session to a Pyrogram session file.
- `telethon_file(file: str)`: Exports the session to a Telethon session file.
- `pyrogram_string_session(version: int = 3, api_id: int = 0)`: Exports the session as a Pyrogram string.
- `telethon_string_session()`: Exports the session as a Telethon string.

### `TDSession`

A data model class for representing Telegram session details, including `dc_id`, `api_id`, `auth_key`, and other properties.

## Requirements

- Python 3.6+
- Pyrogram
- Telethon
- Pydantic

## License

This package is licensed under the MIT License.

---

Let me know if you'd like any changes or additions to this README!
