From 5e87a276472e1423eb2e581764ef730e9ea70625 Mon Sep 17 00:00:00 2001 From: Avindra Goolcharan Date: Thu, 4 Jan 2018 18:15:08 -0500 Subject: [PATCH] Remove stock module Per Yahoo, this service is now discontinued. The CSV file merely returns an error message: * It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such, the service is being discontinued. For all future markets and equities data research, please refer to finance.yahoo.com. --- README.md | 2 +- bumblebee/modules/stock.py | 63 ------------------------------------- screenshots/stock.png | Bin 2087 -> 0 bytes 3 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 bumblebee/modules/stock.py delete mode 100644 screenshots/stock.png diff --git a/README.md b/README.md index 824373d..eebbabf 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ Modules and commandline utilities are only required for modules, the core itself * psutil (for the modules 'cpu', 'memory', 'traffic') * netifaces (for the modules 'nic', 'traffic') -* requests (for the modules 'weather', 'github', 'getcrypto', 'stock') +* requests (for the modules 'weather', 'github', 'getcrypto') * power (for the module 'battery') * dbus (for the module 'spotify') * i3ipc (for the module 'title') diff --git a/bumblebee/modules/stock.py b/bumblebee/modules/stock.py deleted file mode 100644 index 28b5162..0000000 --- a/bumblebee/modules/stock.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: UTF-8 -*- -# pylint: disable=C0111,R0903 - -"""Display a stock quote from yahoo finance. - -Requires the following python packages: - * requests - -Parameters: - * stock.symbols : Comma-separated list of symbols to fetch - * stock.change : Should we fetch change in stock value (defaults to True) - * stock.currencies : List of symbols to go with the values (default $) -""" - -import bumblebee.input -import bumblebee.output -import bumblebee.engine -import bumblebee.util - -import requests - -class Module(bumblebee.engine.Module): - def __init__(self, engine, config): - super(Module, self).__init__(engine, config, - bumblebee.output.Widget(full_text=self.value) - ) - self._symbols = self.parameter("symbols", "") - self._change = bumblebee.util.asbool(self.parameter("change", True)) - self._currencies = self.parameter('currencies', None) - self._baseurl = 'http://download.finance.yahoo.com/d/quotes.csv' - self._value = self.fetch() - - if not self._currencies: - self._currencies = '$' * len(self._symbols) - - # The currencies could be unicode, like the € symbol. Convert to a unicode object. - if hasattr(self._currencies, "decode"): - self._currencies = self._currencies.decode("utf-8", "ignore") - - def value(self, widget): - results = [] - for i, val in enumerate(self._value.split('\n')): - try: - currency_symbol = self._currencies[i] - except: - currency_symbol = '$' - results.append('%s%s' % (currency_symbol, val)) - return u' '.join(results) - - def fetch(self): - if self._symbols: - url = self._baseurl - url += '?s=%s&f=l1' % self._symbols - if self._change: - url += 'c1' - return requests.get(url).text.strip() - else: - return '' - - def update(self, widgets): - self._value = self.fetch() - -# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/screenshots/stock.png b/screenshots/stock.png deleted file mode 100644 index 427f7cf8ae02a243b30e2b8b1bea334fcd07a757..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2087 zcmV+?2-x?DP)T(kyL4OVW@)_%b9g#|A?UHrS5A#$VXRHqU-G_WpQ;m=x>>nKTk{bpN>b-H+dS z_uO;NJ?A|F5LJTJ=|saWut^(<&fV->szaOG@%R#H)eaIdm(AYXpp8SJ(1PA#i7z|| zf~3VFpFgmrBfum_TT%74MV?6B0;jo$2C@ z0k>x!0I&89u}xiQvLoABTeMjOPwXKX1EprBfb>L{2r=j%cRb zJ|r%0+G&$QJGs=Pr%;_9?+Rv<%Vt*O3)XZz*=e*FkJW$OqcE85pSRr(h8CKoiz>yW zr|c{dyno@Q-ehyQy`QwoY)%i>h4@j2+l!UlOeTV$L*vG{SXD)QG`P^xb=Twbw{|PH zBvGnL_*hpm8TJQ)Uc|ptf}s%pw|M<0hmw=XII-5p;lz~n?T@djv__Z5*M4VIr7>2D zx5Zu1Xt52dH8BP(3Xe@stuD-8t8FRB-D2i=fd?nnJmVl@DgD%O#1B$&2Rte0B^kiZ+`%dfwevkmneZqJbiSx(c(~y#qkt7iwbWHD!d31UwD2Ly>)kZZ-s;m z!)ubCa{S(icIvg~o7s%i*IzjJW&7Z*|EK`~5CKx_XU>1q4*-~PxN|v7X_@eoR(o_F zprRn}%Z@>uKz=lo#bPu`OD=qKd)n&cbJ^&9Q#qzL|M8z+VRglrp03Sn;~;_}R61pwgoF4nO<#gB!b zLkNOSAKeWAc<)>riqAt+DU@B3;sg>gzVNWvpnGT-|0O$#3@>>*0D!?{CqWRA2mt^z z21|Y}2diTNkYmmlJ$HwQr=FZf{3uQ=g<1~)xZEMfn$d292oa)B1}B~7_WB;h=f%KU z_pIhRNlG&LgNyBzeVCYB9wM=?S0gqEtBIr|&N1J|$FkAkue#K=QYs7E<{QFG$GVSSAYTVxW zXZKgL8MFh^((J8iUGl}tSVNWQm1n