Fomo Python SDK is the official SDK wrapper for the Fomo API service
Project description
Fomo Python SDK is the official SDK wrapper for the Fomo API service
API docs: https://docs.fomo.com
Requirements
Python version [2.7+, 3.x+]
pyOpenSSL / OpenSSL with SNI support
Python module requests
Installation
Install the latest version with
$ pip install fomo
Manual User Installation
Download Fomo/fomo.py and include the file in your Python project.
Check out our examples in tests/test.py, quick usage examples:
Basic Usage
Initialize Fomo client:
import Fomo
client = Fomo.FomoClient('<token>') # Auth token can be found Fomo application admin dashboard (App -> API Access)
Create a new event with template name:
event = Fomo.FomoEventBasic()
event.event_type_tag = 'new_order' # Event type tag is found on Fomo dashboard (Templates -> Template name)
event.email_address = 'ryan.kulp@fomo.com' # used to fetch Gravatar for notification image
event.title = 'Test event'
event.city = 'San Francisco'
event.url = 'https://www.fomo.com'
# Add event custom attribute value
event.add_custom_event_field('variable_name', 'value')
created_event = client.create_event(event)
print(created_event)
or with template ID:
event = Fomo.FomoEventBasic()
event.event_type_id = '183' # Event type ID is found on Fomo dashboard (Templates -> Template ID)
event.title = 'Test event'
event.city = 'San Francisco'
event.url = 'https://www.fomo.com'
# Add event custom attribute value
event.add_custom_event_field('variable_name', 'value')
created_event = client.create_event(event)
print(created_event)
Fetch an event:
event = client.get_event('<event ID>')
print(event)
Get events:
events = client.get_events(30, 1)
print(events)
Get events with meta data:
data = client.get_events_with_meta(30, 1)
print(data['events'])
print(data['meta']['per_page'])
print(data['meta']['page'])
print(data['meta']['total_count'])
print(data['meta']['total_pages'])
Delete an event:
client.delete_event('<event ID>')
Update an event:
event['first_name'] = 'Donny'
event['custom_event_fields_attributes'] = { 'amount': 19.99 }
updated_event = client.update_event(event)
print(updated_event)
Support
If you have questions, email us at hello@fomo.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fomo-1.2.2.tar.gz
.
File metadata
- Download URL: fomo-1.2.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47d1d5feb4da03594f803100984b8974b84f9e0597ae3edbd7fd4feb33639e90 |
|
MD5 | 4d64d69483afb81a3747a345a19031a5 |
|
BLAKE2b-256 | 23de047489b82b3674f77451fae8ef589f07316df067f3f416adcf87b7a82216 |
File details
Details for the file fomo-1.2.2-py2.py3-none-any.whl
.
File metadata
- Download URL: fomo-1.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2267e6ab93a1d00a1c4517f6bd9ebb5bd37b35f5b57dab3999dc43b6da9cb1a5 |
|
MD5 | bc8276e76332dd8900147ed1d0322c3d |
|
BLAKE2b-256 | 72dc10562d8251a0f47695bc9042d6bdfc075ec68f3611884862ab0a167460b3 |