pythonのapi-clientでgoogle calendarのAPIを叩いてみる

API叩く

これらを参考にしてカレンダーのAPIを叩いてみた。

http://taichino.com/programming/python-programming/3101

Calendar API PyDoc

https://developers.google.com/resources/api-libraries/documentation/calendar/v3/python/latest/

だけどうまくいかない。 ブラウザが起動してしまって(サーバーでやってるからたまたま入れてたw3cが起動して)認証を求められるけど、うまく通らない。 それをqで終了してキャンセルすると、--noauth_local_webserverを付けて実行しろみたいなのが出てくる

If your browser is on a different machine then exit and re-un
this application with the command-line parameter

  --noauth_local_webserver

--noauth_local_webserverを付けてもうまくいかなかったが、ここを見て解決した。 argvを見るようにしないと、そりゃうまくいかないよねということだった https://developers.google.com/api-client-library/python/guide/aaa_oauth#commandline

これを参考に修正するとできた。

pytzは使ってみたけどマシンのスペックのせいかめちゃくちゃ遅かったので使うのやめておいた

参考

pythonで日本語

http://osksn2.hep.sci.osaka-u.ac.jp/~taku/osx/python/encoding.html

連想配列

http://www.pythonweb.jp/tutorial/dictionary/index2.html

日付表記のISO_8601

http://ja.wikipedia.org/wiki/ISO_8601

pythonでISO_8601での日付表記の方法

http://stackoverflow.com/questions/2150739/iso-time-iso-8601-in-python

(ついでにTZInfoの実装もちょっと参考にした)

pythonの日付処理とTimeZone

http://nekoya.github.io/blog/2013/06/21/python-datetime/

pytz

http://pytz.sourceforge.net/#tzinfo-api

datetime

http://docs.python.jp/2/library/datetime.html#strftime-strptime-behavior

pythonのクラスシステム

http://www.shido.info/py/python7.html

pythonの定数(ない)

http://yoshi-python.blogspot.jp/2009/09/blog-post_3279.html

クラス変数とインスタンス変数

http://d.hatena.ne.jp/aroma_black/20110419/1303222363

クラスメソッド

http://jutememo.blogspot.jp/2008/09/python-classmethod-staticmethod.html

連想配列のキーの存在確認

http://www.pythonweb.jp/tutorial/dictionary/index7.html

文字列<->日付の変換

http://qiita.com/shibainurou/items/0b0f8b0233c45fc163cd