Skip to content

Instantly share code, notes, and snippets.

@nanzono
nanzono / get_google_drive_pdfs.py
Created June 21, 2013 02:09
google-api-python-clientを利用して、pdfの一覧を取得する。 oauth2client.client.Credentialsの保存。
# coding:utf-8
import os
import httplib2
from apiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.client import Credentials
def get_credentials_oath2(file_path):
CLIENT_ID = '' # your client id
@nanzono
nanzono / WebElement.py
Created June 6, 2013 03:06
selenium.webdriver.remote.webelement.WebElementの各種プロパティの一覧。毎回調べるのもなんなので。
# selenium.webdriver.remote.webelement.WebElement
web_element_property = [
__class__,
__delattr__,
__dict__,
__doc__,
__eq__,
__format__,
__getattribute__,
@nanzono
nanzono / get_http_header.py
Last active December 15, 2015 08:39
trace 301 and 302 redirect , and print http status code and location.
# coding:utf-8
import httplib
import urlparse
def get_http_header(survey_url):
p = urlparse.urlsplit(survey_url)
hostname = p.netloc
headers = {"User-Agent" : "Mozilla/5.0 (Windows NT 6.1; WOW64) " \
+ "AppleWebKit/537.22 (KHTML, like Gecko) " \