2016/2のアップデートでやり方が変更
oauth2client、gspreadライブラリを用いることでPythonからGoogleスプレッドシートへアクセスできます。
ネットで検索するといろいろとやり方が出てきますが、2016/2のライブラリのアップデートによってSignedJwtAssertionCredentialsクラスがServiceAccountCredentialsクラスに変更になったので注意が必要です。
サンプルスクリプト
import os
import gspread
from oauth2client.service_account import ServiceAccountCredentials
def main():
scope = ['https://spreadsheets.google.com/feeds']
doc_id = 'Your Document ID'
path = os.path.expanduser("JSONファイルのパス")
credentials = ServiceAccountCredentials.from_json_keyfile_name(path, scope)
client = gspread.authorize(credentials)
gfile = client.open_by_key(doc_id)
worksheet = gfile.sheet1
records = worksheet.get_all_value()
for record in records:
print(record.row)
if __name__ == '__main__':
main()


