Skip to content

Instantly share code, notes, and snippets.

@oleoneto
Last active November 26, 2017 03:43
Show Gist options
  • Select an option

  • Save oleoneto/6635f611b8582f4315c3d336dbba4711 to your computer and use it in GitHub Desktop.

Select an option

Save oleoneto/6635f611b8582f4315c3d336dbba4711 to your computer and use it in GitHub Desktop.
An implementation of the EventBrite API. Requires Python 3+, Internet, and an EventBrite API Key.
"""
EventBrite.py
By Leo N.
An implementation of the EventBrite API.
Requirements: Python 3+, Internet, EventBrite API Key.
--------------------
Structure of the JSON for an event object:
name: {
text,
html},
description: {
text,
html},
id,
url,
start: {
timezone,
local,
utc
},
end: {
timezone,
local,
utc
},
created,
changed,
capacity,
capacity_is_custom,
status, currency,
listed,
shareable,
online_event,
tx_time_limit,
hide_start_date,
hide_end_date,
locale, is_locked,
privacy_setting,
is_series,
is_series_parent,
is_reserved_seating,
source,
is_free,
version,
logo_id,
organizer_id,
venue_id,
category_id,
subcategory_id,
format_id,
resource_uri,
logo: {
crop_mask,
id,
url,
aspect_ratio,
edge_color,
edge_color_set,
original: {
url,
width,
height
}
}
"""
# Importing the API Key
from EventBriteAPIKey import key as OAuthKey
# Importing Python web modules
import json, urllib.parse, requests
# Your developer API key
key = OAuthKey
# API Endpoint for user-owned events
eventBrite = "https://www.eventbriteapi.com/v3/users/me/owned_events/"
# API Endpoint: Querying Events in Tempe
eventBriteSearch = "https://www.eventbriteapi.com/v3/events/search/?location.address=Tempe"
def BuildObjects():
data = requests.get(
eventBriteSearch,
headers = { "Authorization": "Bearer " + key,},
verify = True,).json()
size = len(data['events'])
print("\n-------------------")
print("Total Events {}".format(size))
print("-------------------\n")
for index in range(size):
eventID = data['events'][index]['id']
title = data['events'][index]['name']['text']
date = data['events'][index]['start']['local']
capacity = data['events'][index]['capacity']
url = data['events'][index]['url']
print("# {}\nID: {}\nTitle: {}\nDate: {}\nCapacity: {}\nURL: {}\n".format(index+1, eventID, title, date, capacity, url))
def main():
BuildObjects()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment