Skip to main content

API wrapper for Get Response written in Python

Project description

getresponse-python

getresponse-python is an API wrapper for GetResponse written in Python.

Installing

pip install getresponse-python

Usage

from getresponse.client import GetResponse
from getresponse.excs import UniquePropertyError

getresponse = GetResponse('YOUR_API_KEY_HERE')

For GetResponse Enterprise platform:

from getresponse.client import GetResponseEnterprise

getresponse = GetResponseEnterprise('YOUR_API_KEY_HERE', 'YOUR_DOMAIN_NAME', 'YOUR_API_ENDPOINT')

Get account info:

account = getresponse.accounts()

print('Account:', account.id, account.name)

Get all campaigns:

campaigns = getresponse.get_campaigns({'sort': {'name', 'desc'}})

for campaign in campaigns:
    print('Campaign:' campaign.id, campaign.name)

Get a campaign:

campaign = getresponse.get_campaign('CAMPAIGN_ID_HERE')

print('Campaign:', campaign.id, campaign.name)

Create a campaign:

campaign = {
   "name": 'UNIQUE_ID_HERE',
}

try:
   campaign = getresponse.create_campaign(campaign)
   print('Campaign:', campaign.id, campaign.name)
except UniquePropertyError:
   print("Cannot create: campaign's name already exists.")

Get all contacts:

# Example:
contacts = getresponse.get_contacts({'sort[createdOn]': 'ASC', 'query[name]': 'juan'})
for contact in contacts:
    print('Contact:', contact.id, contact.name)

Get a contact:

contact = getresponse.get_contact('CONTACT_ID_HERE')
if contact:
    print('Contact:', contact.id, contact.name)

Create a contact:

values = {
    "email": "CONTACT_EMAIL_HERE",
    "campaign": {
        'campaignId': 'CAMPAIGN_ID_HERE',
    },
}

try:
    contact = getresponse.create_contact(values)
    print('Contact in queue to be created.')
except UniquePropertyError:
    print("Cannot created: contact's email already exists.")

Delete a contact:

contact = getresponse.delete_contact('CONTACT_ID_HERE')

Update a contact:

body = {
    "name": "Test Name",
    "customFieldValues": [
        {"customFieldId": "pLQSI0", "value": ["comment 1234"]},
        {"customFieldId": "pLQSu3", "value": ["+573108889999"]},
    ],
}
contact = getresponse.update_contact(self, contact_id, body)

Get all custom fields:

custom_fields = getresponse.get_custom_fields({'sort': {'name', 'desc'}})
for custom_field in custom_fields:
    print('Custom Field:', custom_field.id, custom_field.name)

Get a custom field:

custom_field = getresponse.get_custom_field('CUSTOM_FIELD_ID_HERE')
if custom_field:
    print('Custom Field:', custom_field.id, custom_field.name)

Requirements

  • requests

Contributing

We are always grateful for any kind of contribution including but not limited to bug reports, code enhancements, bug fixes, and even functionality suggestions.

You can report any bug you find or suggest new functionality with a new issue.

If you want to add yourself some functionality to the wrapper:

  1. Fork it ( https://github.com/GearPlug/getresponse-python )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Adds my new feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

getresponse_python-0.1.5.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

getresponse_python-0.1.5-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file getresponse_python-0.1.5.tar.gz.

File metadata

  • Download URL: getresponse_python-0.1.5.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for getresponse_python-0.1.5.tar.gz
Algorithm Hash digest
SHA256 ca8503048eb8e0f24becec4a5e199f0b6b80db027a599179ee02b6cd58483b85
MD5 9c4a187ec5a90fd5043f847633bf9cbd
BLAKE2b-256 70d36a56da0f60f9689fd3f494ecfe7142dd9ef66ee94bfcac08e4619d8b3069

See more details on using hashes here.

File details

Details for the file getresponse_python-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for getresponse_python-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5e08f9c7dbb399e2976cfde4bcf1b03eb6a3db310504ec40d0e8ac6f0cf3eb63
MD5 e84fa3f78e541bec75d19f38f6e617a8
BLAKE2b-256 2f41b964c57b526b65ae7938a69add05404bab212af375c7ef664211028251f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page