株価のデータを取得する際に、jsmモジュールが便利だと知ったので
https://pypi.python.org/pypi/jsm/0.19 を参考に今日の株価を取得しようと思っています。
プログラムを実行したところエラーが出てしまいます。
調べたところ「パーサーが指定されておらず、html.parser を使いました」という警告で、実際の株価は取得できていたのですが、警告を出さないためにはどのように指定すれば良いでしょうか。
/Library/Python/2.7/site-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently. The code that caused this warning is on line 9 of the file ImportStockData.py. To get rid of this warning, change code that looks like this: BeautifulSoup(YOUR_MARKUP}) to this: BeautifulSoup(YOUR_MARKUP, "html.parser") markup_type=markup_type)) 今のカルビーの株価は <date:2017-06-14 12:29:15.052357 open:4545 high:4595 low:4505 close:4545 volume:384800 _adj_close:4545>
python
1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3import sys 4import codecs 5import jsm #Yahoo!ファイナンスからスクレイピングしたもの 6 7q=jsm.Quotes() #jsm.Quotesのインスタンスを作成 8 9calbee=q.get_price(2229) #当日の株価の取得 10print u'今のカルビーの株価は' 11print calbee
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/06/14 07:24
2017/06/14 10:18