{"id":18547366,"url":"https://github.com/rnevarezc/pyostal","last_synced_at":"2025-04-09T20:31:13.732Z","repository":{"id":62582322,"uuid":"464952115","full_name":"rnevarezc/pyostal","owner":"rnevarezc","description":"A lightweight Postal API Client for Python","archived":false,"fork":false,"pushed_at":"2022-04-05T20:00:01.000Z","size":16,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T11:21:30.092Z","etag":null,"topics":["api","api-client","client","postal","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rnevarezc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-01T15:35:31.000Z","updated_at":"2024-03-06T21:21:09.000Z","dependencies_parsed_at":"2022-11-03T21:22:22.223Z","dependency_job_id":null,"html_url":"https://github.com/rnevarezc/pyostal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnevarezc%2Fpyostal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnevarezc%2Fpyostal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnevarezc%2Fpyostal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnevarezc%2Fpyostal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rnevarezc","download_url":"https://codeload.github.com/rnevarezc/pyostal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248107286,"owners_count":21048893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","client","postal","python"],"created_at":"2024-11-06T20:29:07.880Z","updated_at":"2025-04-09T20:31:13.385Z","avatar_url":"https://github.com/rnevarezc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PYostal: Postal API Client\n\nThis library helps you use the [Postal](https://github.com/atech/postal) API in Python 3.9 (and above) to send Emails, get Message Details \u0026 Deliveries and Implement Events to handle Server Webhooks.\n\nIt uses [Requests](https://github.com/psf/requests) the simple, yet elegant HTTP library to handle all the http sorcery.\n\n## Installing Requests and Supported Versions\n\nPYostal is available on PyPI:\n\n```bash\n$ python -m pip install pyostal\n```\nPYostal officially supports Python 3.9+.\n\n## Usage\n\n### Using the Client\n\nYou will need an API Credential from your Postal Installation to use the API Client.\n\n```python\nfrom pyostal.client import Client\n\n# Create a new Postal client using the server key of your Postal Installation.\nclient = Client('https://postal.yourdomain.com', 'your-api-key')\n\n# Optional: You can add any aditional Headers for your API installation\n# (Maybe Authorization)\n# You just add a dict with your headers:\nheaders = {\n    'Authorization' =\u003e 'Basic RTYtaO54BGBtcG9yYWwyMDIw'\n}\n\nclient = Client('https://postal.yourdomain.com', 'your-api-key', headers)\n\n#Or you can add them manually to a Client Instance:\nclient.headers = headers\n```\n\n### Sending an Email\n\nSending an email is simple. You can follow the example below:\n\n```python\n# Create a dict with the message:\npayload = {\n    'to': ['mail@example.com'],\n    'from_address': 'othermail@example.com',\n    'reply_to': 'reply-to@example.com',\n    'subject': 'This is a subject',\n    'plain_body': 'This is a body'\n}\n\n#send it using the client. that's it\nresponse = client.send(payload)\n```\nOr Create a new Email instance and add manually each of the Mail attributes\n```python\n\nfrom pyostal.emails import Email\n\nemail = Email({\n    'to': ['mail@example.com'],\n    'bcc': ['test1@example.com', 'test2@example.com'],\n    'from_address': 'othermail@example.com',\n    'reply_to': 'reply-to@example.com',\n    'subject': 'This is a subject',\n    'plain_body': 'This is a body'\n})\n\nemail.add_cc('emailcc@example.com')\nemail.html_body = \"\u003cp\u003eThis is a HTML body\u003c/p\u003e\"\n\n# Here we get a pyostal.response.Response instance\nresponse = client.send(Email)\n```\n## API Information\n\nYou can get more information about the Postal API and Payloads in the [Postal Project Wiki](https://github.com/postalhq/postal/wiki/Using-the-API)\n\n## Author\n\nRafael Nevarez\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnevarezc%2Fpyostal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnevarezc%2Fpyostal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnevarezc%2Fpyostal/lists"}