-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMeetupCollector.py
More file actions
41 lines (30 loc) · 1.15 KB
/
MeetupCollector.py
File metadata and controls
41 lines (30 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'''
A Collector for meetup.com
Created on Jul 19, 2014
@author: aponte
'''
import json
import requests
class MeetupCollector():
def __init__(self, city, state, query):
""" Returns the JSON from querying the API
for CITY, STATE, and the QUERY.
"""
self.city = city
self.state = state
self.query = query
self.url = self.createURL()
def getJSON(self):
""" Returns the JSON representation of the
API call.
"""
data = requests.get(self.url).text
data = json.loads(data)
return data
def createURL(self):
""" Builds and returns the URL based on the search parameters. """
url = "http://api.meetup.com/2/open_events?status=upcoming&radius=25.0&state=" + self.state + "&and_text=False&limited_events=False&text=" + self.query + "&desc=False&city=" + self.city + "&offset=0&photo-host=public&format=json&page=20&country=us&sig_id=14329201&sig=e31eef1653769211053be6849d5285b63f0593f6"
return url
def getURL(self):
""" Returns THIS URL. """
return self.url