{"id":878,"date":"2013-11-07T00:50:23","date_gmt":"2013-11-06T15:50:23","guid":{"rendered":"http:\/\/43.203.250.216\/?p=878"},"modified":"2020-12-30T17:24:29","modified_gmt":"2020-12-30T08:24:29","slug":"app-engine%ec%97%90%ec%84%9c-google-calendar-event-%ea%b0%80%ec%a0%b8%ec%98%a4%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/litcoder.com\/?p=878","title":{"rendered":"App engine &#8211; \uc9c0\uc815\ud55c \ub2ec\uc758 google calendar event \uac00\uc838\uc624\uae30"},"content":{"rendered":"\n<p><a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/v3\/reference\/events\/list\">Google calendar API \uc124\uba85\ubb38\uc11c<\/a>\uc5d0\ub294 event list\ub97c \uac00\uc838\uc624\ub294 \ubc29\ubc95\uc774 \uc124\uba85\uacfc \ud568\uaed8 \uc608\uc81c code\uac00 \uc81c\uc2dc\ub418\uc5b4 \uc788\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"eclipse\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">page_token = None\nwhile True:\n  events = service.events().list(calendarId='primary', pageToken=page_token).execute()\n  for event in events['items']:\n    print event['summary']\n  page_token = events.get('nextPageToken')\n  if not page_token:\n    break<\/pre>\n\n\n\n<p><em>\uc774 \ucf54\ub4dc\ub97c \uc218\ud589\ud558\uba74 \ub2ec\ub825\uc774 \uac00\uc9c0\uace0 \uc788\ub294 \ubaa8\ub4e0 event\ub4e4\uc744 \uac00\uc838\uc624\ub294\ub370, \uc774\uac83\uc744 \uc870\uae08 \uc218\uc815\ud574\uc11c \uc9c0\uc815\ub41c \ub2ec\uc5d0 \ud574\ub2f9\ud558\ub294 event \ubaa9\ub85d\uc744 \uac00\uc838\uc624\ub294 \uac83\uc73c\ub85c \ubcc0\uacbd\ud574 \ubcf4\uc790.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>timeMax \/&nbsp;timeMin<\/strong><\/h3>\n\n\n\n<p>\uac00\uc838\uc62c event\uc758 \ubc94\uc704\ub294 lower bound\ub97c \ub098\ud0c0\ub0b4\ub294 timeMin\uacfc upper bound\ub97c \ub098\ud0c0\ub0b4\ub294 timeMax\uac12\uc73c\ub85c \uc81c\ud55c\ud560 \uc218 \uc788\ub294\ub370 \uc774\ub54c \uc0ac\uc6a9\ub418\ub294 \ub0a0\uc9dc\uc758 \ud615\uc2dd\uc740 <a href=\"http:\/\/www.ietf.org\/rfc\/rfc3339.txt\">RFC3339<\/a>\uc744 \ub530\ub77c\uc57c \ud55c\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>calendar.monthrange()&nbsp;<\/strong><\/h3>\n\n\n\n<p>\uc774 method\ub294 \ub144\ub3c4\uc640 \uc6d4\uc744 \ubc1b\uc544\uc11c \uc2dc\uc791\uc77c\uc758 \uc8fc\uc640 \ub9c8\uc9c0\ub9c9 \ub0a0\uc9dc\ub97c tuple\ub85c \ubc18\ud658\ud574 \uc900\ub2e4. \ub2e4\uc74c\uacfc \uac19\uc774 \ud2b9\uc815 \ub2ec\uc758 \ub9c8\uc9c0\ub9c9 \ub0a0\uc9dc\ub97c \uad6c\ud560 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">>>> import calendar\n>>> calendar.monthrange(2002, 06)\n(5, 30)\n>>> calendar.monthrange(2002, 06)[1]\n30<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Python\uc5d0\uc11c RFC3339 \ud45c\uc2dc\ud558\uae30<\/strong><\/h3>\n\n\n\n<p>\uc774 \ud615\uc2dd\uc740 \uac04\ub2e8\ud788 \ub9d0\ud574 \ub0a0\uc9dc\ub97c \ub098\ud0c0\ub0b4\ub294 YYYY-MM-DD \ud615\uc2dd\uacfc \uc2dc\uac04\uc744 \ub098\ud0c0\ub0b4\ub294 hh:mm:ss\uac00 \ub300\ubb38\uc790 &#8216;T&#8217;\ub85c \uc5f0\uacb0\ub418\uba70 \uadf8 \ub4a4\uc5d0\ub294 UTC\ub85c \ubd80\ud130\uc758 time zone offset\uac12\uc774 \ubd99\ub294\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">2002-06-30T20:00:00+09:00<\/pre>\n\n\n\n<p>datetime.isoformat()\uc744 \uc774\uc6a9\ud558\uba74 \ube44\uc2b7\ud55c \ud615\uc2dd\uc744 \uc5bb\uc744 \uc218\ub294 \uc788\uc73c\ub098, \ub4a4\uc5d0 \ubd99\ub294 time zone offset\uc774 \ud45c\uc2dc\ub418\uc9c0 \uc54a\ub294\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">>>> datetime(2002, 06, 30, 20, 0, 0).isoformat()\n'2002-06-30T20:00:00'<\/pre>\n\n\n\n<p>Python\uc5d0\uc11c time zone\uc744 \ub098\ud0c0\ub0b4\ub294<a href=\"http:\/\/docs.python.org\/2\/library\/datetime.html#datetime.tzinfo\"> tzinfo class\uc758 \uc124\uba85\ubb38<\/a>\uc5d0 \ub530\ub974\uba74 tzinfo\ub294 abstract class\uc5ec\uc11c \uc9c1\uc811 \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uace0, \uc774\ub97c \uc0c1\uc18d\ubc1b\ub294 class\ub97c \uad6c\ud604\ud574\uc11c \uc0ac\uc6a9\ud574\uc57c \ud55c\ub2e4. \ub2e4\uc74c\uc740 \uc774 \ubb38\uc11c\uc5d0 \uc788\ub294 \uc608\uc81c\ub97c \uc870\uae08 \uc218\uc815\ud558\uc5ec time zone offset \uac12\uc744 \ubc18\ud658\ud558\ub294 tzinfo\uc758 concrete class\ub97c \uad6c\ud604\ud55c \uac83\uc774\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"eclipse\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from datetime import tzinfo, timedelta, datetime\n\nZERO = timedelta(0)\nHOUR = timedelta(hours=1)\n\nclass TimeZoneOffset(tzinfo):\n    def __init__(self, hours, name):\n        self.__offset = timedelta(hours = hours)\n        self.__name = name\n\n    def utcoffset(self, dt):\n        return self.__offset\n\n    def tzname(self, dt):\n        return self.__name\n\n    def dst(self, dt):\n        return ZERO<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong style=\"line-height: 1.714285714; font-size: 1rem;\">Code<\/strong><\/h2>\n\n\n\n<p>TimeZoneOffset class\ub97c \uc120\uc5b8\ud55c \ud6c4\uc5d0\ub294 datetime()\uc744 \ud638\ucd9c\ud560\ub54c tzinfo\uc5d0 TimeZoneOffset\uc758 instance\ub97c \ub118\uaca8\uc11c time zone offset \uc815\ubcf4\ub97c \ud3ec\ud568\ud558\ub294 RFC3339 \ub0a0\uc9dc \ud615\uc2dd\uc744 \uc5bb\uc744 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"eclipse\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># What's the last date of the Jun, 2002?\nlastDate = calendar.monthrange(2002, 6)[1]\n\n# Lower bound RFC3339 format '2002-06-01T00:00:00+09:00'\nlbound = datetime(2002, 6, 1, tzinfo=TimeZoneOffset(9, \"KST\")).isoformat()\n\n# Lower bound RFC3339 format '2002-06-01T23:59:59+09:00'\nubound = datetime(2002, 6, lastDate, 23, 59, 59, tzinfo=TimeZoneOffset(9, \"KST\")).isoformat()\n\npage_token = None\nwhile True:\n  # Fetch events within given lower\/upper bounds.\n  events = service.events().list(calendarId='primary', minTime=lbound, maxTime=ubound, pageToken=page_token).execute()\n  for event in events['items']:\n    print event['summary']\n  page_token = events.get('nextPageToken')\n  if not page_token:\n    break<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Google calendar API \uc124\uba85\ubb38\uc11c\uc5d0\ub294 event list\ub97c \uac00\uc838\uc624\ub294 \ubc29\ubc95\uc774 \uc124\uba85\uacfc \ud568\uaed8 \uc608\uc81c code\uac00 \uc81c\uc2dc\ub418\uc5b4 \uc788\ub2e4. \uc774 \ucf54\ub4dc\ub97c \uc218\ud589\ud558\uba74 \ub2ec\ub825\uc774 \uac00\uc9c0\uace0 \uc788\ub294 \ubaa8\ub4e0 event\ub4e4\uc744 \uac00\uc838\uc624\ub294\ub370, \uc774\uac83\uc744 \uc870\uae08 \uc218\uc815\ud574\uc11c \uc9c0\uc815\ub41c \ub2ec\uc5d0 \ud574\ub2f9\ud558\ub294 event \ubaa9\ub85d\uc744 \uac00\uc838\uc624\ub294 \uac83\uc73c\ub85c \ubcc0\uacbd\ud574 \ubcf4\uc790. timeMax \/&nbsp;timeMin \uac00\uc838\uc62c event\uc758 \ubc94\uc704\ub294 lower bound\ub97c \ub098\ud0c0\ub0b4\ub294 timeMin\uacfc upper bound\ub97c \ub098\ud0c0\ub0b4\ub294 timeMax\uac12\uc73c\ub85c \uc81c\ud55c\ud560 \uc218 \uc788\ub294\ub370 \uc774\ub54c \uc0ac\uc6a9\ub418\ub294 \ub0a0\uc9dc\uc758 \ud615\uc2dd\uc740 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[16,25,105],"class_list":["post-878","post","type-post","status-publish","format-standard","hentry","category-programming","tag-appengine","tag-calendar-api","tag-python"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts\/878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=878"}],"version-history":[{"count":1,"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts\/878\/revisions"}],"predecessor-version":[{"id":2759,"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts\/878\/revisions\/2759"}],"wp:attachment":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}