Welcome to CSV2Sendy’s Documentation

CSV2Sendy

PyPI version Python Version Tests Coverage Status Documentation Status License: MIT Code Style: Mypy

A powerful CSV processor for Sendy.co with Brazilian data format support.

Documentation | GitHub Repository

🌟 Features

  • πŸ”„ Intelligent CSV Processing

    • Auto-detection of delimiters (, or ;)

    • Multiple encoding support (utf-8-sig, latin1, iso-8859-1, cp1252)

    • Smart column mapping and normalization

    • Robust error handling

  • πŸ“§ Email Validation

    • RFC-compliant email validation

    • Case normalization

    • Duplicate removal

    • Invalid email filtering

  • πŸ“± Phone Number Processing

    • Brazilian format support

    • Format standardization

    • Invalid number filtering

    • DDD (area code) validation

  • πŸ‘€ Name Processing

    • First/last name splitting

    • Proper capitalization

    • Special character handling

    • Empty name filtering

  • 🌐 Web Interface

    • File upload and processing

    • Column mapping

    • Tag management

    • CSV download

  • πŸ”’ Security

    • Secure file handling

    • Automatic file cleanup

    • Input sanitization

    • File size limits

πŸ“¦ Installation

Using pip

pip install csv2sendy

From source

git clone https://github.com/skaisser/csv2sendy.git
cd csv2sendy
pip install -e ".[dev]"

πŸš€ Quick Start

Web Interface

# Start the web server
python -m csv2sendy.web.app

Visit http://localhost:8080 in your browser.

Python API

from csv2sendy.core import CSVProcessor

# Process a CSV file
processor = CSVProcessor()
df = processor.process_file('input.csv')
df.to_csv('output.csv', index=False)

# Process CSV content directly
content = '''name,email,phone
John Doe,john@example.com,(11) 98765-4321'''
df = processor.process_file(content)

πŸ’» Development

Setup

  1. Clone the repository:

git clone https://github.com/skaisser/csv2sendy.git
cd csv2sendy
  1. Create a virtual environment:

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install development dependencies:

pip install -e ".[dev,test,doc]"

Testing

Run tests with coverage:

pytest --cov=csv2sendy tests/

Run type checking:

mypy csv2sendy

Documentation

Build documentation:

cd docs
make html

πŸ”§ Dependencies

  • Python 3.9

  • pandas >= 1.3.0

  • email-validator >= 1.1.0

  • flask >= 2.0.0

  • werkzeug >= 2.0.0

🀝 Contributing

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/amazing-feature)

  3. Install development dependencies (pip install -e ".[dev,test,doc]")

  4. Make your changes

  5. Run tests and type checking (pytest and mypy csv2sendy)

  6. Commit your changes (git commit -m 'Add amazing feature')

  7. Push to the branch (git push origin feature/amazing-feature)

  8. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘€ Author

Shirleyson Kaisser

  • GitHub: @skaisser

  • Email: skaisser@gmail.com

API Documentation

Certificates

*.pem *.key *.crt *.cer *.p12 *.pfx

Environment and config

.env .env.* *.conf config.ini

Credentials

.aws/ credentials/ credentials

Core Module

Process CSV files for Sendy compatibility.

class csv2sendy.core.processor.CSVProcessor[source]

Bases: object

Process CSV files for Sendy compatibility.

__init__()[source]

Initialize CSVProcessor.

process_name(name)[source]

Process a name into first and last name components.

format_phone_number(phone)[source]

Format phone number to Brazilian format.

validate_email_address(email)[source]

Validate email address format.

detect_delimiter(content)[source]

Detect CSV delimiter.

process_csv(content)[source]

Process CSV content.

process_file(file_content)[source]

Process a CSV file.

Web Module

Web application module for CSV2Sendy.

This module provides a Flask-based web interface for processing CSV files for Sendy.co. It includes routes for file upload, processing, and download with custom column mapping.

Key Features:
  • File upload with multiple encoding support

  • CSV processing with Brazilian data format support

  • Custom column mapping

  • Tag addition

  • Duplicate email removal

csv2sendy.web.app.cleanup_temp_files()[source]

Clean up temporary files.

csv2sendy.web.app.allowed_file(filename)[source]

Check if file extension is allowed.

csv2sendy.web.app.home()[source]

Render home page.

csv2sendy.web.app.upload_file()[source]

Handle file upload.

csv2sendy.web.app.download_file(filename)[source]

Handle file download.

Indices and Tables