Skip to main content

Library wrapper for GroupMe API

Project description

LowerPines: GroupMe API Wrapper for Python

This library provides a Python wrapper around the GroupMe v3 API.


Use pip to install:

pip3 install lowerpines

Basic Usage

This requires a Access Token from the GroupMe developers site

The first step to doing anything with this library is to create a GMI object:

from lowerpines.gmi import get_gmi

gmi = get_gmi(access_token='access token here')

A GMI object stores a copy of the Access Token and serves as a context for various functions. The get_gmi(access_token) method will get a GMI from the cache or create one if necessary. GMI objects also provide common functions:

for group in gmi.groups:

for bot in gmi.bots:

for chat in gmi.chats:
    print(chat, chat.other_user)

test_group = gmi.groups.get(name='Testing Group')
test_bot = gmi.bots.get(group_id=test_group.group_id)'Hello, world!')

GroupMe supports complex message structures, such as including GroupMe-specific emoji, pictures, etc. This information can be utilized through ComplexMessage objects:

from lowerpines.message import ImageAttach

# This will dynamically create a ComplexMessage object:
complex_message = ImageAttach('URL to GroupMe processed image here') + 'Look at my cool picture'

The various MessageAttach objects (such as ImageAttach, EmojiAttach, etc.) will automatically convert themselves into a ComplexMessage object when added to a str or to another MessageAttach object. However, a MessageAttach object is not a ComplexMessage object, so the following is not allowed:'URL here'))  # This will trigger an exception

The correct way to do this is to create a ComplexMessage object manually:

from lowerpines.message import ComplexMessage

complex_message = ComplexMessage(ImageAttach('URL here'))

Viewing messages for groups is also available:

for message in test_group.messages.recent():

Each message’s text is also available as a ComplexMessage object through message.complex_text

Please see the docs directory for more information.

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

lowerpines-0.6.0.tar.gz (20.2 kB view hashes)

Uploaded source

Built Distribution

lowerpines-0.6.0-py3-none-any.whl (26.8 kB view hashes)

Uploaded py3

Supported by

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