Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish to PyPI

on:
release:
types:
- created

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install build tools
run: pip install hatch

- name: Build package
run: hatch build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

publish:
needs: build
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/project/pysendpulse/

permissions:
id-token: write

steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
32 changes: 0 additions & 32 deletions .github/workflows/pythonpublish.yml

This file was deleted.

52 changes: 29 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
*~
env/
venv/

# Byte-compiled / optimized / DLL files
# Python
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.pyo
*.pyd
*.so
*.egg
*.egg-info/
dist/
build/
wheels/

# Translations
*.mo
*.pot
# Virtual environment
.venv/
venv/
env/

# Django stuff:
*.log
# Type checking
.mypy_cache/

# sqlite3
*.sqlite3
# Linter
.ruff_cache/

# sockets and pid
*.sock
*.pid
/*.gitkeep
*.save
*.retry
# Tests
.pytest_cache/
htmlcov/
.coverage
coverage.xml

# IDE
.idea/
.vscode/
*.iml

# macOS
.DS_Store

dist/
*.egg-info
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Changelog

All notable changes to this project will be documented in this file.

## [2.0.0] — 2026-08-25

Complete rewrite of `pysendpulse` as version 2.0.0.

### BC Breaks

- **License** — changed from Apache-2.0 to MIT.
- **Entry point changed** — use `from sendpulse import Client` instead of `from pysendpulse.pysendpulse import PySendPulse`.
- **Constructor** — `Client(client_id=..., client_secret=...)` or `Client(api_key=...)`; the old positional `(REST_API_ID, REST_API_SECRET, TOKEN_STORAGE)` signature is gone.
- **Service layer** — flat methods on the client (`add_campaign()`, `smtp_send_mail()`, etc.) replaced by typed facades (`email_service()`, `smtp_service()`, etc.).
- **Exceptions** — typed hierarchy (`AuthException`, `RateLimitException`, `ApiException`, `NetworkException`, `ProtocolException`) replaces the old generic error handling.
- **Python 3.11+** required (was 3.x without a strict minimum).
- **Storage** — Memcached/file backends replaced by `FileTokenStorage` and `InMemoryTokenStorage`.

### Added

- Typed service facades: `email_service()`, `smtp_service()`, `sms_service()`, `crm_service()`, `chatbot_service()`.
- Services and models generated from OpenAPI specs — all endpoints covered.
- `TokenStorage` protocol with `FileTokenStorage` (atomic write) and `InMemoryTokenStorage`.
- Auto-retry on `401` — cached token is invalidated and a fresh one fetched before retrying once.
- Context manager support (`with Client(...) as client:`).
- Custom `HttpClient` and `TokenStorage` injection points for testing and custom transports.

---

## [0.1.8] — 2025-02-11

- Fixed re-send request handling.

## [0.1.7] — 2023-07-21

- Updated version metadata.

## [0.1.6] — 2023-07-21

- Fixed response getter.

## [0.1.5] — 2023-03-31

- Version bump.

## [0.1.4] — 2022-07-01

- Added SMS functional methods.

## [0.1.3] — 2021-09-28

- Added Automation360 method.

## [0.1.2] — 2021-02-04

- Added custom token path support.

## [0.1.1] — 2020-06-10

- Release preparation.

## [0.1.0] — 2020-04-13

- Fixed SMS variables check.

## [0.0.9] — 2020-03-26

- Initial stable release.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2015 SendPulse

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading