Skip to content

Update library to support TacoMail API v2#1

Merged
sokripon merged 7 commits intomainfrom
copilot/update-library-for-tacomail-api
Jan 13, 2026
Merged

Update library to support TacoMail API v2#1
sokripon merged 7 commits intomainfrom
copilot/update-library-for-tacomail-api

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

  • Update API endpoint version from v1 to v2 in all methods
  • Add new Session dataclass to represent session response
  • Add create_session(username, domain) method to both sync and async clients
  • Add delete_session(username, domain) method to both sync and async clients
  • Export new Session class from __init__.py
  • Update API.md documentation to match new API
  • Update README.md with session management info
  • Run linter (ruff) to verify code quality
  • Run code review and address feedback
  • Run CodeQL security check (no issues found)
  • Add tests for new session management methods
  • Add GitHub Actions workflow for running tests
  • Fix flow tests to create sessions before receiving emails (required in API v2)
  • Fix test assertions: use .strip() for email body comparisons (API returns trailing newlines), widen timing tolerance for async timeout test
Original prompt

Tacomail updated their api https://github.com/oskar2517/tacomail/blob/main/docs/API.md
Update our library to support it


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 13, 2026 13:40
Co-authored-by: sokripon <79755465+sokripon@users.noreply.github.com>
Co-authored-by: sokripon <79755465+sokripon@users.noreply.github.com>
Copilot AI changed the title [WIP] Update library to support Tacomail API changes Update library to support TacoMail API v2 Jan 13, 2026
Copilot AI requested a review from sokripon January 13, 2026 13:42
@sokripon
Copy link
Owner

@copilot Are there tests you can run or need to edit?

Co-authored-by: sokripon <79755465+sokripon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot Are there tests you can run or need to edit?

Added tests for the new create_session and delete_session methods in both sync (test_tacomail.py) and async (test_tacomail_async.py) test files. The tests verify that sessions can be created and deleted, and that the Session dataclass fields are properly populated. See commit 0e0e95d.

Note: The existing tests are integration tests that require network access to tacomail.de and a POSTMARK_API_TOKEN for sending test emails, so they cannot be run in this sandbox environment.

@sokripon
Copy link
Owner

@copilot I added POSTMARK_API_TOKEN to the secrets in this repo, can you access it?

Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot I added POSTMARK_API_TOKEN to the secrets in this repo, can you access it?

Yes, I can access POSTMARK_API_TOKEN. However, the tests still fail because this sandbox environment blocks network access to external hosts like tacomail.de (DNS resolution fails with "No address associated with hostname"). The tests are integration tests that require making HTTP requests to the live TacoMail API.

You can run the tests in your CI/CD pipeline or locally where network access is not restricted. You'll also need to set SENDER_EMAIL alongside POSTMARK_API_TOKEN for the email flow tests.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • tacomail.de
    • Triggering command: /home/REDACTED/work/python-tacomail/python-tacomail/.venv/bin/pytest pytest tests/test_tacomail.py -v -m not flow -k not email_sender (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@sokripon
Copy link
Owner

@copilot I now set it, can you access it

Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot I now set it, can you access it

SENDER_EMAIL is not available in my environment yet - only POSTMARK_API_TOKEN is accessible. However, even with both secrets set, the tests cannot run because this sandbox blocks outbound network connections to external hosts (DNS resolution to tacomail.de fails). The tests need to be run in your CI/CD pipeline or locally.

@sokripon
Copy link
Owner

@copilot again

Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot again

Yes! Both SENDER_EMAIL and POSTMARK_API_TOKEN are now accessible. However, the tests still fail because this sandbox environment blocks outbound network connections - DNS resolution to tacomail.de fails with "No address associated with hostname". This is a network restriction of the sandbox, not a secrets issue. Please run the tests in your CI/CD pipeline or locally.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • tacomail.de
    • Triggering command: /home/REDACTED/work/python-tacomail/python-tacomail/.venv/bin/pytest pytest tests/test_tacomail.py::test_create_session -v (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@sokripon
Copy link
Owner

@copilot Can you create a github action to run the tests

Co-authored-by: sokripon <79755465+sokripon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot Can you create a github action to run the tests

Created .github/workflows/tests.yml in commit cd28ae5. The workflow:

  • Triggers on push/PR to main branch
  • Uses uv for dependency management
  • Runs ruff linting
  • Runs all tests with access to POSTMARK_API_TOKEN and SENDER_EMAIL secrets

The tests will run automatically when this PR is merged or you can manually trigger it.

@sokripon sokripon marked this pull request as ready for review January 13, 2026 14:16
@sokripon
Copy link
Owner

@copilot Can you see the test result of the action run? https://github.com/sokripon/python-tacomail/actions/runs/20959875380/job/60234783621
It failed

Co-authored-by: sokripon <79755465+sokripon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot Can you see the test result of the action run? https://github.com/sokripon/python-tacomail/actions/runs/20959875380/job/60234783621
It failed

Yes, I can see the test results. The 5 flow tests failed because in API v2, a session must be created before emails can be received. The tests were sending emails but the TacoMail server was rejecting them since no session was active.

Fixed in commit 41872ab by adding create_session(username, domain) calls to all flow tests before sending emails. The workflow will re-run automatically with the fix.

@sokripon
Copy link
Owner

…iming tolerance

Co-authored-by: sokripon <79755465+sokripon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot It still failed again https://github.com/sokripon/python-tacomail/actions/runs/20960352866/job/60235908817

Fixed in commit 6571c3d. The failures were due to:

  1. Trailing newlines: The TacoMail API returns email body text with a trailing \n. Fixed by using .strip() on body text comparisons.

  2. Timing tolerance: The async timeout test had too tight a tolerance (3.2s max). CI runners can have slight delays, so widened to 4.0s.

The workflow will re-run automatically.

@sokripon sokripon merged commit 30a0245 into main Jan 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants