Skip to content
Merged
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
20 changes: 20 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
layout_poetry() {
PYPROJECT_TOML="${PYPROJECT_TOML:-pyproject.toml}"
if [[ ! -f "$PYPROJECT_TOML" ]]; then
log_status "No pyproject.toml found. Executing \`poetry init\` to create a \`$PYPROJECT_TOML\` first."
poetry init
fi

VIRTUAL_ENV=$(poetry env info --path 2>/dev/null ; true)

if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then
log_status "No virtual environment exists. Executing \`poetry install\` to create one."
poetry install
VIRTUAL_ENV=$(poetry env info --path)
fi

PATH_add "$VIRTUAL_ENV/bin"
export POETRY_ACTIVE=1
export VIRTUAL_ENV
}

layout_poetry
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build-n-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.16
Expand Down
4 changes: 2 additions & 2 deletions mailerlite/sdk/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def get_group_subscribers(self, group_id, **kwargs):
Ref: https://developers.mailerlite.com/docs/groups.html#get-subscribers-belonging-to-a-group

:param group_id: int Group ID
:param **kwargs: You can pass additional arguments - page, limit, sort or to filter by status
:param **kwargs: You can pass additional arguments - cursor, limit, sort or to filter by status
:raises: :class: `TypeError` : Got an unknown argument
:raises: :class: `TypeError` : `group_id` type is not valid
:return: JSON array
Expand All @@ -131,7 +131,7 @@ def get_group_subscribers(self, group_id, **kwargs):
f"`group_id` type is not valid. Expected `int`, got {type(group_id)}."
)

available_params = ["filter", "limit", "page"]
available_params = ["filter", "limit", "cursor"]

params = locals()
query_params = {}
Expand Down
2,375 changes: 1,336 additions & 1,039 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name = "mailerlite"
version = "0.1.10"

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.10"
requests = "^2.28.1"

[tool.poetry.dev-dependencies]
black = "^22.10.0"
black = "^25.0.0"
coverage = "^6.5.0"
pytest = "^7.2.0"
pytest-mock = "^3.10.0"
python-dotenv = "^0.21.0"
python-semantic-release = "^7.32.2"
vcrpy = "^4.2.1"
vcrpy = "^7.0.0"

[build-system]
build-backend = "poetry.core.masonry.api"
Expand Down
4 changes: 2 additions & 2 deletions tests/campaigns_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_given_proper_parameters_when_user_calls_create_then_new_campaign_is_cre
{
"subject": "This is a test campaign",
"from_name": "Test Man",
"from": "testuser@mailerlite.com",
"from": "sdk@igor.fail",
"content": "<html><body><h1>Test</h1></body></html>",
}
],
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_given_correct_parameters_when_user_calls_update_then_existing_campaign_
{
"subject": "This is a new test campaign subject",
"from_name": "Test Man",
"from": "testuser@mailerlite.com",
"from": "sdk@igor.fail",
}
],
}
Expand Down
2 changes: 1 addition & 1 deletion tests/groups_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_given_correct_group_id_when_calling_get_group_subscribers_then_list_of_
):
# This test requires at least one subscriber assigned to a group
response = self.client.groups.get_group_subscribers(
pytest.entity_id, limit=5, page=1
pytest.entity_id, limit=5, cursor=1
)

assert isinstance(response, dict)
Expand Down
37 changes: 20 additions & 17 deletions tests/vcr_cassettes/automations-activity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,12 @@ interactions:
uri: https://connect.mailerlite.com/api/automations/112078014094771336/activity?filter%5Bstatus%5D=active
response:
body:
string: !!binary |
H4sIAAAAAAAAA7SRwU7DMBBEf6XaQ09WHdNCwAjxB4h7XaElbFoLxw72OiqK8u8obaqAOPe20u5o
3s708IGMoLc7Ac76zwS6h9rGxKDhwNwmbaSRVfCeKl41aB1FZ5lWVWiMxNYaiZlDg2yDT0YqdVOU
94XaFA+bslTr9Z2RWLHtLH8/t7inJwUCHF7ZoI3UgfbZOQGejnyeBwENje/2UOUYyfPbqACtBNQx
NBfFiDdvply2PeTo5pN3cqBh6fArh8fFa6TOhpxAwImGQNfoEg1ikl01zTOL+mXOMc/ef5Ff6MiL
ZTxx/8PdCWiRD1fgHVuhOMV6WwjgcCHjwOhAF8PwAwAA//8DAHDbHFqQAgAA
string: '{"data":[],"links":{"first":"https:\/\/connect.mailerlite.com\/api\/automations\/112078014094771336\/activity?page=1","last":"https:\/\/connect.mailerlite.com\/api\/automations\/112078014094771336\/activity?page=1","prev":null,"next":null},"meta":{"current_page":1,"from":null,"last_page":1,"links":[{"url":null,"label":"&laquo;
Previous","active":false},{"url":"https:\/\/connect.mailerlite.com\/api\/automations\/112078014094771336\/activity?page=1","label":"1","active":true},{"url":null,"label":"Next
&raquo;","active":false}],"path":"https:\/\/connect.mailerlite.com\/api\/automations\/112078014094771336\/activity","per_page":50,"to":null,"total":0}}'
headers:
Access-Control-Allow-Origin:
- '*'
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 84f37bdc2bf22788-PRG
- 9818a331592296e0-BEG
Cache-Control:
- no-cache, private
Connection:
Expand All @@ -38,19 +31,29 @@ interactions:
Content-Type:
- application/json
Date:
- Fri, 02 Feb 2024 15:31:55 GMT
- Fri, 19 Sep 2025 11:10:35 GMT
Server:
- cloudflare
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Transfer-Encoding:
- chunked
X-Locale:
access-control-allow-origin:
- '*'
alt-svc:
- h3=":443"; ma=86400
cf-cache-status:
- DYNAMIC
strict-transport-security:
- max-age=31536000; includeSubDomains
x-account_id:
- '83510'
x-locale:
- en
X-RateLimit-Limit:
x-ratelimit-limit:
- '120'
X-RateLimit-Remaining:
x-ratelimit-remaining:
- '117'
x-user_id:
- '106223'
status:
code: 200
message: OK
Expand Down
64 changes: 30 additions & 34 deletions tests/vcr_cassettes/automations-get.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,22 @@ interactions:
uri: https://connect.mailerlite.com/api/automations/112078014094771336
response:
body:
string: !!binary |
H4sIAAAAAAAAA+xX227jNhD9FYHYYl+UWLIk2xJQbG/oJsEmL02bTeqAoKWxzIQiFV6seAP/e0FJ
lmXH2yTtok99MjyXM4fD4czoCWVEE5Q8IZqhBPn+0BtPPD/04nA89oNghFzESQEoQb/RomTgVMBS
UYADBaEMuQg4mTHIUKKlARdpSfMcJN7AaknSewypKAqQKaBkTpgCF0kogWjr2omWhNEWZ90BKZT8
uU9uMgkCzxtNLDm9Ki05ZWYqlXQGEt8JyhXOpTAlclH9i2lmcZDveV4cjKLIj31/OB5Nhui2NenH
eW7VJeGjNCVxfOQiIxlK0ELrUiXTwXSQEbWYCSKzY5sYkIxqOE5FMR1suakP0jBQ31/5enxaxNXN
57NF9jFend4JSq6i+fVVFJ3Sil4PY3PzkXnkKjZWdxOcLbPPP32pdZ/PeLo6HV2tznhaxH56ck4/
/aro+eWP1fkv918u7n73zy/vH88vT4OLu3x1yvxs/oefofWti+AxZSYD3M/KVpzhLhW3LppJcQ+8
vR3rnApbABo2V71j4KKKSE553norTbSyBbDxynAvDzgVhmuUeC7qSynHDwYM9NQzYXgKWBIb9wnN
mSCtn5aU5yhB3ndo7aKU0fQea4FFCfxlcwUtvjXv0zGcPhjAO2JuGGssX8njAOCuvEFsOL8IaXiX
o13gTvyK85ak6Cfd/n3RaUFkhpsL6AfuiV8RWMz1AYye+GWMuZCVjfmKYCklDFOuQZJUU7F/h88N
XgK1VyqB2Pq1ajT0huGRNzzyho4fJtEkCQNkU6LwjHAOGU4F13Vxtc/iwRBG5/Rw/fs2GpSHmlzs
Df1xGAe9JrdpuSWRwDW29s2x2uZ0tdealZndQaoPaOZSFChBNBfyh9121SpxC3nYQkLJVliLrxrU
cfBe146D8WQUhuON/vnU6ZuQtM5RAzIJIt/b+Nmhgb8+rrY2bdqI0aIgdTVsczkzlGUg/4NcvPly
SkYoxxoerfIEGBPulE/5tTDOgizBkZACXULmEIdDpRhoDdKxTJ2nd23a1sfW5URUsATpOithZIPv
2JdXEQlOSvh77WRUlYysnJPL80+NhTp2bKiUcGdJoXL0AvpxZiun7luU584CJCQ20NM7I9n6iVF+
f0SzpLkX35uEnhdF/iQerq1Ve4r3cnMGi6EXVO3gQ0qMAku5Oa5aiIo79ZMFpR3Kd095IXSntDnh
q0JI+OD8bEnWDB0tnF6zTGq62/8HaAfxOPRG/ihY24tKJQBXC6Hx/sxXWkiSw3EuRM6AlFQ1E39b
A0dbb3VUSpFNB1vJdNAkfDp4/gKmA384CR/HwWjbcY78KPG8xA+PS57bQpFgb+gZrVbeX0So6MTT
Qf2a/i44erHphXYDKrPDJlHiDRPfolCFM1A059sFkRGeG5I3LzisTSrKOciuY3arw5uGtPdtJ7T3
/3h+43ju+3+Lie39k3H9xkWw2QQzTObaFmAzTZtPlrq4NkVrFCisjFzCqivTWvZg6JdOUkpYALFT
JUGWyn6p7y/Q/+aNhUkUJ5HdPQ7QbfoRJpywlaap2jkZ5TmuiMIZVe2XW0s/A1uupU2z/dwDnjnT
3eE0Rd2QsmO022LWt+v1XwAAAP//AwAaeo+tSg4AAA==
string: '{"data":{"id":"112078014094771336","name":"Simple welcome email","enabled":false,"trigger_data":{"track_ecommerce":false,"repeatable":false,"valid":true,"complete_workflow":true,"broken_workflow":false},"triggers":[{"id":"112078014883300686","type":"subscriber_joins_group","group_ids":["100093655191127682"],"groups":[{"id":"100093655191127682","name":"Grupa
1","url":"https:\/\/dashboard.mailerlite.com\/subscribers?rules=W1t7Im9wZXJhdG9yIjoiaW5fYW55IiwiY29uZGl0aW9uIjoiZ3JvdXBzIiwiYXJncyI6WyJncm91cHMiLFsiMTAwMDkzNjU1MTkxMTI3NjgyIl1dfV1d"}],"exclude_group_ids":[],"excluded_groups":[],"broken":false,"complete":true}],"complete":true,"broken":false,"warnings":[],"emails_count":1,"stats":{"completed_subscribers_count":0,"subscribers_in_queue_count":0,"bounce_rate":{"float":0,"string":"0%"},"click_to_open_rate":{"float":0,"string":"0%"},"sent":0,"opens_count":0,"unique_opens_count":null,"open_rate":{"float":0,"string":"0%"},"clicks_count":0,"unique_clicks_count":null,"click_rate":{"float":0,"string":"0%"},"unsubscribes_count":0,"unsubscribe_rate":{"float":0,"string":"0%"},"spam_count":0,"spam_rate":{"float":0,"string":"0%"},"hard_bounces_count":0,"hard_bounce_rate":{"float":0,"string":"0%"},"soft_bounces_count":0,"soft_bounce_rate":{"float":0,"string":"0%"},"forward_rate":{"float":0,"string":"0%"},"social_interactions_count":null,"social_interaction_rate":{"float":0,"string":"0%"}},"created_at":"2024-02-02
14:58:43","has_banned_content":false,"qualified_subscribers_count":1,"automation_template_id":1,"automation_template_name":"Simple
welcome email","steps":[{"id":"112078014902174936","type":"email","parent_id":null,"name":"Welcome
email","subject":"Welcome email","from":"igor@mailerlite.com","from_name":"igor@mailerlite.com","reply_to":"igor@mailerlite.com","email_id":"112078014893786447","email":{"id":"112078014893786447","account_id":"83510","emailable_id":"112078014094771336","emailable_type":"automations","type":"builder","from":"igor@mailerlite.com","from_name":"igor@mailerlite.com","reply_to":"igor@mailerlite.com","name":"Welcome
email","subject":"Welcome email","plain_text":"Hello,\n\nYou have received
a newsletter from {$account}.\n\nHowever, your email software can''t display
HTML emails. You can view the newsletter by clicking here:\n\n{$url}{link-id:112078108400551892}\n\n\n\nYou''re
receiving this newsletter because you have shown interest in {$account}.\nNot
interested anymore? Click here to unsubscribe:\n{$unsubscribe}{link-id:112078108397406163}","screenshot_url":"https:\/\/storage.googleapis.com\/mailerlite-screenshots-prod\/screenshot\/emails\/112078014893786447\/1284x7362024-02-02-15:00:14.png","generate_screenshot_timestamp":null,"preview_url":"https:\/\/preview.mailerlite.io\/preview\/83510\/emails\/112078014893786447","created_at":"2024-02-02
14:58:44","updated_at":"2025-08-29 10:23:40","is_designed":true,"language_id":4,"is_winner":false,"stats":{"sent":0,"opens_count":0,"open_rate":{"float":0,"string":"0%"},"clicks_count":0,"click_rate":{"float":0,"string":"0%"},"unsubscribes_count":0,"unsubscribe_rate":{"float":0,"string":"0%"},"spam_count":0,"spam_rate":{"float":0,"string":"0%"},"hard_bounces_count":0,"hard_bounce_rate":{"float":0,"string":"0%"},"soft_bounces_count":0,"soft_bounce_rate":{"float":0,"string":"0%"},"forwards_count":0,"forward_rate":{"float":0,"string":"0%"},"social_interactions_count":0,"social_interaction_rate":{"float":0,"string":"0%"},"click_to_open_rate":{"float":0,"string":"0%"}},"send_after":null,"track_opens":true,"uses_survey":false,"uses_quiz":false,"preheader":""},"language_id":4,"complete":false,"created_at":"2024-02-02
14:58:44","updated_at":"2025-08-29 10:23:40","track_opens":true,"google_analytics":null,"tracking_was_disabled":false,"broken":false,"has_unsubscribe_url":true,"eligible_for_sending":false,"preheader":"","builder_type":"builder","description":"Send
\"Welcome email\" email","type_count":1}]}}'
headers:
Access-Control-Allow-Origin:
- '*'
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 84f37bd96aad4114-PRG
- 9818a330181cc687-BEG
Cache-Control:
- no-cache, private
Connection:
Expand All @@ -55,19 +41,29 @@ interactions:
Content-Type:
- application/json
Date:
- Fri, 02 Feb 2024 15:31:54 GMT
- Fri, 19 Sep 2025 11:10:35 GMT
Server:
- cloudflare
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Transfer-Encoding:
- chunked
X-Locale:
access-control-allow-origin:
- '*'
alt-svc:
- h3=":443"; ma=86400
cf-cache-status:
- DYNAMIC
strict-transport-security:
- max-age=31536000; includeSubDomains
x-account_id:
- '83510'
x-locale:
- en
X-RateLimit-Limit:
x-ratelimit-limit:
- '120'
X-RateLimit-Remaining:
x-ratelimit-remaining:
- '118'
x-user_id:
- '106223'
status:
code: 200
message: OK
Expand Down
Loading