2021-05-01 10:39:20 +00:00
|
|
|
|
2021-04-27 18:29:14 +00:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import threading
|
|
|
|
from PIL import Image, ImageDraw, ImageFont
|
|
|
|
import time
|
|
|
|
import csv
|
|
|
|
|
|
|
|
from rgbmatrix import RGBMatrix, RGBMatrixOptions
|
|
|
|
from stockTicker import StockTicker
|
2021-04-28 19:39:30 +00:00
|
|
|
import finnhub
|
|
|
|
|
2021-05-01 10:39:20 +00:00
|
|
|
import pexpect
|
2021-05-14 12:02:22 +00:00
|
|
|
from pycoingecko import CoinGeckoAPI
|
2021-05-27 19:10:57 +00:00
|
|
|
from newsapi import NewsApiClient
|
2021-04-27 18:29:14 +00:00
|
|
|
|
2021-05-31 11:22:56 +00:00
|
|
|
import sys, os
|
|
|
|
try:
|
|
|
|
raise NotImplementedError("No error")
|
|
|
|
except Exception as e:
|
|
|
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
|
|
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
|
|
|
print(exc_type, fname, exc_tb.tb_lineno, exc_obj, exc_tb)
|
|
|
|
|
2021-04-27 18:29:14 +00:00
|
|
|
if __name__ == '__main__':
|
2021-05-25 18:57:34 +00:00
|
|
|
|
2021-05-27 19:10:57 +00:00
|
|
|
newsapi = NewsApiClient(api_key='cf08652bd17647b89aaf469a1a8198a9')
|
2021-05-25 18:57:34 +00:00
|
|
|
|
2021-05-27 19:10:57 +00:00
|
|
|
top_headlines = newsapi.get_top_headlines(q='bitcoin',
|
|
|
|
category='business',
|
|
|
|
country='us')
|
2021-05-01 10:39:20 +00:00
|
|
|
|
2021-04-28 19:39:30 +00:00
|
|
|
|
2021-05-27 19:10:57 +00:00
|
|
|
'''
|
|
|
|
top_headlines = newsapi.get_everything(q='bitcoin',
|
|
|
|
sources='bbc-news,the-verge',
|
|
|
|
page=1)
|
|
|
|
'''
|
|
|
|
#print(top_headlines)
|
|
|
|
headline_titles = [top_headline['title'] for top_headline in top_headlines['articles']]
|
|
|
|
headline_ids = [top_headline['source']['name'] for top_headline in top_headlines['articles']]
|
|
|
|
headline_times = [top_headline['publishedAt']for top_headline in top_headlines['articles']]
|
|
|
|
|
|
|
|
#print([top_headline.keys()for top_headline in top_headlines['articles']])
|
|
|
|
print(headline_titles)
|
|
|
|
print(headline_ids)
|
|
|
|
print(headline_times)
|
|
|
|
|
2021-04-27 18:59:25 +00:00
|
|
|
|