Giter Site home page Giter Site logo

getresponse-python's Introduction

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

getresponse-python's People

Contributors

diegoleft avatar gustav0 avatar ihatetrains avatar ingmferrer avatar johannx64 avatar juanrios15 avatar seroy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

getresponse-python's Issues

Contacts older than a year do not appear in get_contacts

When using the module contacts that are pulled from Get Response that signed up more than a year ago are not populated in the pull from your contacts list

edit: default per page contacts is 100, I upped it to a higher number and it worked. Not sure if this will work forever but for now it's fixed.

Update a contact using email.

By updating a user by email we don't have to save an extra field on the database to manage the user id on Get Response, and because email is a unique constraint there won't be any problem, right?

Now we have to create a contact (this returns true, not the contact_id), search between all contacts and filter by email to get the contact_id and then update using the contact_id.

Otherwise you just create a contact, and then update using the email as a filter.

Maybe I'm wrong with the actual process to update a contact. If that's the case, could you please tell me how it's supposed to be done right?

Thank you!

get_campaign_contacts raises TypeError: exceptions must derive from BaseException

Hey guys,
thanks for this wrapper - I'm trying to figure it out and expand it with tag functionality.

I must note that, although I have a solid programmer background, I have not coded for a decade, so understandably i am a bit slow hehe :)

I've been playing with the wrapper/GR API for a few hours now, and had success with the more basic methods like:
accounts();
get_campaigns();
get_campaign();

After I got the campaign id I actually need to work withon, tried to get all the contacts in it by using 'get_campaign_contacts', which raises the error:

TypeError: exceptions must derive from BaseException

that I fail to make sense out of it.

I did succeed to invoke the corresponding api method directly using requests (without the wrapper):
https://api.getresponse.com/v3/campaigns/{campaign_id}/contacts

Which made me wander - what is actually wrong with the way the wrapper does the same?

Any ideas why is it not properly working?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.