Web

webフォント 「Noto Snas Japanese」

notosansjapanese.jpg

→無料の日本語フォント【Noto Sans Japanese】があまりにも美しいので、ブログに使ってみた

→【Noto Sans Japanese】ブログの記事を綺麗なフォントで表示したいので最軽量化してみた

cssファイルにgoogleからフォントをインポートします style.cssに以下を追加

@import url(http://fonts.googleapis.com/earlyaccess/notosansjapanese.css);

各要素にフォントを適応します(cssの最後に呼び出すとすべてに有効になると思います←確認様までに)

*{
 font-family: 'Noto Sans Japanese', sans-serif;
 }

Noto Sans Japanesは細いとさらにカッコ良いので、適度にfont-weightを設定しておきます。

 *{
  font-weight: 100;
  font-weight: 200;
  font-weight: 300;
  font-weight: 400;
  font-weight: 500;
  font-weight: 600;
  font-weight: 700;
  font-weight: 800;
  font-weight: 900;
 }

webフォント 「Source Code Pro」

s-sourcecodepro.jpg

https://www.google.com/fonts#UsePlace:use/Collection:Source+Code+Pro

@import url(http://fonts.googleapis.com/css?family=Source+Code+Pro);
*{ 
   font-family: 'Source Code Pro';
 }

Webフォントの軽量化

  1. サブセットフォントメーカーのインストール
  2. 第一水準漢字 のダウンロード
s-font_subset2.jpg

サブセットメーカーを使って、フォントサイズを小さくする

s-font_subset1.jpg

元の16MBから、圧縮後の-compだと、700KB程度に

使い方。(/fonts配下に設置した場合)

@font-face {
   font-family: 'NotoSansCJKjp-Light';
   src: url('./fonts/noto.woff'),url('./fonts/noto.eot');
}

body {
   font-family: 'NotoSansCJKjp-Light';
}

Google Analystics API

321268087270-c6nrdep9v3suagivv821q16pi6pkadcs@developer.gserviceaccount.com

PythonでGoogle Analytics APIを使うためにやること

Python で Google Analytics API を使うためにやったこと

sudo pip install httplib2
sudo pip install python-gflags
sudo pip install google-api-python-client

ひとまず公式チュートリアルを通す

  1. Google Developers Consoleにて、プロジェクトを選択するか、新しいものを作成する →Google Developers Console
gapi-1.png
  1. 「APIと認証」>「API」から"Analytics API"が有効なAPIとして登録されているか確認する。

# ref(gapi-2.png)

gapi-3.png

アカウントはサービスアカウントを選択

gapi-4.png

これで、秘密鍵ができ、jsonファイルがダウンロードされます。

client_secrets.p12みたいなファイルがダウンロードされる。名前をそれにしておく。(チュートリアルでよびだすので)

じゅんびかんりょう!!

error

 oauth2client.client.CryptoUnavailableError: No crypto library available

いろいろ調べていると、インポートエラーが発生していた。

 ImportError: No encryption library found. Please install either PyOpenSSL, or PyCrypto 2.6 or later
sudo pip install PyOpenSSL

error

returned "User does not have any Google Analytics account.">

→初心者でも分かる!なGoogle Analytics APIの使い方

ハマりポイント

→Google Analytics query explorer →Google Analytics Cookbok

Python OAuth2認証でGoogleアナリティクスの情報を取得する

http://symfoware.blog68.fc2.com/blog-entry-1720.html

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS