Skip to content

Instantly share code, notes, and snippets.

@choro3
Created August 25, 2013 08:18
Show Gist options
  • Select an option

  • Save choro3/6332637 to your computer and use it in GitHub Desktop.

Select an option

Save choro3/6332637 to your computer and use it in GitHub Desktop.
# coding: utf-8
"""
Yahooファイナンスからトルコリラ/円の為替レートを取得するだけ
"""
import sys
import argparse
import urllib
from pyquery import PyQuery as pq
def fetch_turjpy():
res = urllib.urlopen('http://stocks.finance.yahoo.co.jp/stocks/detail/?code=TRYJPY=X')
d = pq(res.read())
return [e.text for e in d('.ymuiEditLink.mar0 strong')]
def main():
bid, ask = fetch_turjpy()
print bid, ask
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment