Created
January 26, 2015 05:22
-
-
Save moyfujii/0ce033bad01af6f2fd62 to your computer and use it in GitHub Desktop.
connpassのAPIでイベントを検索するスクリプト。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import json | |
import urllib, urllib2 | |
BASE_URL = "http://connpass.com/api/v1/event/" | |
def search(**kwargs): | |
params = urllib.urlencode(kwargs) | |
res = urllib2.urlopen("%s?%s" % (BASE_URL, params)) | |
ress = res.read() | |
return json.loads(ress) | |
def printd(d): | |
print "results_returned:\t%s" % d["results_returned"] | |
print "results_available:\t%s" % d["results_available"] | |
print "results_start:\t%s" % d["results_start"] | |
for event in d["events"]: | |
print "event_id:\t%s" % event["event_id"] | |
print "title:\t%s" % event["title"] | |
print "catch:\t%s" % event["catch"] | |
print "event_url:\t%s" % event["event_url"] | |
print "started_at:\t%s" % event["started_at"] | |
print "ended_at:\t%s" % event["ended_at"] | |
if __name__ == "__main__": | |
keyword = "" | |
ymd = "20150219,20150220,20150221" | |
d = search(keyword=keyword, ymd=ymd) | |
printd(d) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment