yfinance-exporter 1.0.10__py3-none-any.whl → 1.0.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yfinance-exporter
3
- Version: 1.0.10
3
+ Version: 1.0.12
4
4
  Summary:
5
5
  Author: François Schmidts
6
6
  Author-email: francois@schmidts.fr
@@ -0,0 +1,4 @@
1
+ yfinance_exporter.py,sha256=6whsA4pOho_xJBpJfgycqD-ddlkvwDbgU-1nwjMSdBQ,4374
2
+ yfinance_exporter-1.0.12.dist-info/METADATA,sha256=1bPKzHh_Cv4PNCSHYNruMYd-QHLfM2LMfQaFxFjfPug,1526
3
+ yfinance_exporter-1.0.12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
4
+ yfinance_exporter-1.0.12.dist-info/RECORD,,
yfinance_exporter.py CHANGED
@@ -76,7 +76,7 @@ def collect(stock) -> bool:
76
76
  ticker = Ticker(stock.ycode)
77
77
  try:
78
78
  value = ticker.fast_info["last_price"]
79
- except KeyError:
79
+ except (KeyError, AttributeError):
80
80
  logger.warning("%r: no value from yfinance", stock.name)
81
81
  value = None
82
82
  if not isinstance(value, (int, float)):
@@ -95,7 +95,7 @@ def update_state(result: bool, key: str, states: dict, labels: dict):
95
95
  previous = states.get(key)
96
96
  states[key] = result
97
97
  if previous == result:
98
- logger.debug("%r: result %r => %r UNCHANGED", key, previous, result)
98
+ logger.debug("%s(%r => %r) UNCHANGED", key, previous, result)
99
99
  return
100
100
  inc_key, dec_key = "items-ok", "items-ko"
101
101
  if not result:
@@ -117,9 +117,6 @@ def main():
117
117
  states = {}
118
118
  while True:
119
119
  start = datetime.now()
120
- DAEMON.labels(status="items-ok", **labels).set(0)
121
- DAEMON.labels(status="items-ko", **labels).set(0)
122
-
123
120
  for stock in conf.stocks:
124
121
  result = collect(stock)
125
122
  update_state(result, stock.isin, states, labels)
@@ -131,6 +128,7 @@ def main():
131
128
  DAEMON.labels(status="loop-count", **labels).inc()
132
129
  interval = int(conf.loop.interval - exec_interval)
133
130
  if interval > 0:
131
+ logger.debug("Waiting %d to complete the loop interval", interval)
134
132
  time.sleep(interval)
135
133
 
136
134
 
@@ -1,4 +0,0 @@
1
- yfinance_exporter.py,sha256=MsgOXZ7yKEyLfWrfzRmOK30gnIfaRerYs2Evte0ZyKI,4401
2
- yfinance_exporter-1.0.10.dist-info/METADATA,sha256=fCjDBZrinTuToD7Yl1j2vH3LjB3SwxmXGiNOfux4iCQ,1526
3
- yfinance_exporter-1.0.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
4
- yfinance_exporter-1.0.10.dist-info/RECORD,,