Skip to content

Instantly share code, notes, and snippets.

@scari
Created September 22, 2015 14:19
Show Gist options
  • Save scari/fefbceba7c966562104c to your computer and use it in GitHub Desktop.
Save scari/fefbceba7c966562104c to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import json
import gspread
from numpy.random import choice
from oauth2client.client import SignedJwtAssertionCredentials
SCOPE = ['https://spreadsheets.google.com/feeds']
json_key = json.load(open('google-apis-6b5aa3a6304d.json'))
credentials = SignedJwtAssertionCredentials(json_key['client_email'], bytes(json_key['private_key'], 'utf-8'), SCOPE)
gs = gspread.authorize(credentials)
rows = gs.open('PyCon Korea 2015 설문조사(응답)').sheet1.get_all_records()
print(choice([ r["선물을 안내해 드릴 이메일 주소를 알려주세요."] for r in rows if r["선물을 안내해 드릴 이메일 주소를 알려주세요."] != ''], 10, replace=False))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment