Closed KSuondProject closed 3 years ago
Now I've manually created a "Dashweb.sock" file in that folder and now the error is different:
2020/12/28 13:46:04 [crit] 613#613: *1 connect() to unix:/home/pi/dashboard/www/Dashweb.sock failed (13: Permission denied)
Just before I go try this one to change the permissions of the sock folder (www)
https://stackoverflow.com/questions/39919053/django-gunicorn-sock-file-not-created-by-wsgi
As this example
sudo chown ben:www-data /home/ben/myproject/
I've found a problem! The upper-case of "Dashweb.sock" was the problem! I've renamed the file and the text in the service and now it works!! :sunglasses:
Is it normal that the forms on the webserver is too big and there's a overlay problem? I can't see all the page and some description is put over a to another. There's something to edit in the html file?
And now I have the other problem, when I try to launch the dashboard.py it says me that it desn't found a "gspread" module but the module is correctly installed. How I can resolve this new problem?
Thanks again!!
Little update, I've setup the webserver with my APIs and the page response me correctly! So I think that this part of code is ok! Now remains the problems with the main python process. I've tried to upgrade the gspread module but nothing.
pi@raspberrypi:~/dashboard $ sudo python3 dashboard.py
Traceback (most recent call last):
File "dashboard.py", line 11, in <module>
from modules import db_tasklist as d_tl
File "/home/pi/dashboard/modules/db_tasklist.py", line 4, in <module>
import gspread
ModuleNotFoundError: No module named 'gspread'
pi@raspberrypi:~/dashboard $ pip install gspread
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting gspread
Downloading gspread-3.6.0.tar.gz (35 kB)
Requirement already satisfied: google-auth-oauthlib>=0.4.1 in /home/pi/.local/lib/python2.7/site-packages (from gspread) (0.4.1)
Requirement already satisfied: google-auth>=1.12.0 in /home/pi/.local/lib/python2.7/site-packages (from gspread) (1.23.0)
Requirement already satisfied: requests>=2.2.1 in /home/pi/.local/lib/python2.7/site-packages (from gspread) (2.24.0)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /home/pi/.local/lib/python2.7/site-packages (from google-auth-oauthlib>=0.4.1->gspread) (1.3.0)
Requirement already satisfied: setuptools>=40.3.0 in /usr/lib/python2.7/dist-packages (from google-auth>=1.12.0->gspread) (40.8.0)
Requirement already satisfied: six>=1.9.0 in /home/pi/.local/lib/python2.7/site-packages (from google-auth>=1.12.0->gspread) (1.15.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /home/pi/.local/lib/python2.7/site-packages (from google-auth>=1.12.0->gspread) (0.2.8)
Requirement already satisfied: rsa<4.6; python_version < "3.5" in /home/pi/.local/lib/python2.7/site-packages (from google-auth>=1.12.0->gspread) (4.5)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /home/pi/.local/lib/python2.7/site-packages (from google-auth>=1.12.0->gspread) (3.1.1)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /home/pi/.local/lib/python2.7/site-packages (from requests>=2.2.1->gspread) (1.25.10)
Requirement already satisfied: certifi>=2017.4.17 in /home/pi/.local/lib/python2.7/site-packages (from requests>=2.2.1->gspread) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in /home/pi/.local/lib/python2.7/site-packages (from requests>=2.2.1->gspread) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /home/pi/.local/lib/python2.7/site-packages (from requests>=2.2.1->gspread) (2.10)
Requirement already satisfied: oauthlib>=3.0.0 in /home/pi/.local/lib/python2.7/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib>=0.4.1->gspread) (3.1.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /home/pi/.local/lib/python2.7/site-packages (from pyasn1-modules>=0.2.1->google-auth>=1.12.0->gspread) (0.4.8)
Building wheels for collected packages: gspread
Building wheel for gspread (setup.py) ... done
Created wheel for gspread: filename=gspread-3.6.0-py2-none-any.whl size=26097 sha256=92b3596dae83759d286e6eb88cd4d418e2384daa7f8439ab0bde33f0de259950
Stored in directory: /home/pi/.cache/pip/wheels/66/94/ef/88a5b4593fa114e43f809de575a5d2b51a65c2334360b7e73f
Successfully built gspread
Installing collected packages: gspread
Successfully installed gspread-3.6.0
and the module is present on pip list:
pi@raspberrypi:~/dashboard/www $ pip list
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Package Version
------------------------ ---------
asn1crypto 0.24.0
cachetools 3.1.1
certifi 2020.6.20
chardet 3.0.4
click 7.1.2
configparser 3.5.0b2
cryptography 2.6.1
dnspython 1.16.0
entrypoints 0.3
enum34 1.1.6
Flask 1.1.2
Flask-WTF 0.14.3
futures 3.3.0
google-api-core 1.23.0
google-api-python-client 1.12.8
google-auth 1.23.0
google-auth-httplib2 0.0.4
google-auth-oauthlib 0.4.1
googleapis-common-protos 1.52.0
gspread 3.6.0
gunicorn 19.10.0
httplib2 0.18.1
idna 2.10
ipaddress 1.0.17
itsdangerous 1.1.0
Jinja2 2.11.2
keyring 17.1.1
keyrings.alt 3.1.1
MarkupSafe 1.1.1
nginx 0.0.1
numpy 1.16.2
oauth2client 4.1.3
oauthlib 3.1.0
olefile 0.46
Pillow 5.4.1
pip 20.3.3
protobuf 3.14.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycairo 1.18.2
pycrypto 2.6.1
PyGObject 3.30.4
pytz 2020.4
pyxdg 0.25
requests 2.24.0
requests-oauthlib 1.3.0
RPi.GPIO 0.7.0
rsa 4.5
SecretStorage 2.3.1
setuptools 40.8.0
six 1.15.0
spidev 3.5
uritemplate 3.0.1
urllib3 1.25.10
Werkzeug 1.0.1
wheel 0.32.3
WTForms 2.3.3
I've commented the "tasklist" and "meetings" module to see if the script can run but I'm blocked here:
pi@raspberrypi:~/dashboard $ sudo python3 dashboard.py
Initializing and clearing screen.
Traceback (most recent call last):
File "dashboard.py", line 142, in <module>
news_0 = d_n.get_news(NEWS_URL, NEWS_API, NEWS_SOURCES, NEWS_COUNTRY, 0, black)
File "/home/pi/dashboard/modules/db_news.py", line 46, in get_news
chk_str = int(len(str(n_data["articles"][x]["title"])))
IndexError: list index out of range
the API link is working fine in the browser. It seams that the webserver doesn't communicate the data with the main application?
do pip3 install gspread pip3 install --upgrade google-api-python-client oauth2client
dont use sudo when running dashboard.py just python3 dashboard.py
when you run the api link of the news in the browser, how many news does it show from your country, count the title variable
Without using sudo the google module seems to be ok!
But there's always the problem with the news API. in the browser the link gives me:
{"status":"ok","totalResults":34,"articles":
So I think that the link is ok, there's a way to see if the parameters of the web server is correctly linked with the main application? Are the parameters stored somewhere?
Is it normal that my dashweb.sock file is empty? is there the problem? Normally what contains this file?
I'm not sure about the sock file, dont have access to my computer to check due being in vacation, are you still having problems with the web server?
-whats the country you are looking the news from? -one way to check out a the problem you are having is this, -open db_news.py, go to line 49 and uncomment that line (remove the "#" and the space before the "print(x)", so it can stay in the same level as the line above it, save it and run the dashboard again -check in the terminal what's the last number it throws
The webserver is like this for me, is it normal?
I'm not sure about the sock file, dont have access to my computer to check due being in vacation, are you still having problems with the web server?
-whats the country you are looking the news from? -one way to check out a the problem you are having is this, -open db_news.py, go to line 49 and uncomment that line (remove the "#" and the space before the "print(x)", so it can stay in the same level as the line above it, save it and run the dashboard again -check in the terminal what's the last number it throws
The country is IT (Italy) for the news, ok I try now your command and let you know!
I cant seem to open that link can you attach it like images
I cant seem to open that link can you attach it like images
I'm not sure about the sock file, dont have access to my computer to check due being in vacation, are you still having problems with the web server?
-whats the country you are looking the news from? -one way to check out a the problem you are having is this, -open db_news.py, go to line 49 and uncomment that line (remove the "#" and the space before the "print(x)", so it can stay in the same level as the line above it, save it and run the dashboard again -check in the terminal what's the last number it throws
Nothing change after removing the comment in the db_news:
pi@raspberrypi:~/dashboard $ python3 dashboard.py Initializing and clearing screen. Traceback (most recent call last): File "dashboard.py", line 142, in <module> news_0 = d_n.get_news(NEWS_URL, NEWS_API, NEWS_SOURCES, NEWS_COUNTRY, 0, black) File "/home/pi/dashboard/modules/db_news.py", line 46, in get_news chk_str = int(len(str(n_data["articles"][x]["title"]))) IndexError: list index out of range
ah, yeah, its probably due the size of your screen, you'll need to modify the www/static/style.css for moving the rectangles around and www/templates/settings.html to reduce the size of the letter in the size variable
for the news lets try to uncomment line 18 along with the space before the "print" -run it again
pass me the link it gives you without your api key
I've removed "country=it" from the API link and now the db_news read correctly:
pi@raspberrypi:~/dashboard $ python3 dashboard.py
Initializing and clearing screen.
{'status': 'ok', 'totalResults': 34, 'articles': [{'source': {'id': None, 'name': 'Mediaset.it'}, 'author': 'Redazione Sportmediaset', 'title': "Napoli, nuova pretendente per Milik: lo vuole l'Atletico Madrid per sostituire Diego Costa - Sportmediaset - Sport Mediaset", 'description': 'Il polacco prima scelta di Simeone per l'attacco: De Laurentiis preferirebbe la cessione all'estero', 'url': 'https://www.sportmediaset.mediaset.it/mercato/napoli/napoli-nuova-pretendente-per-milik-lo-vuole-latletico-madrid-per-sostituire-diego-costa_27046744-202002a.shtml', 'urlToImage': 'https://img-prod.sportmediaset.mediaset.it/images/2020/12/29/074142201-df765ef7-b8ea-42f8-941c-ade56e05929b.jpg', 'publishedAt': '2020-12-29T07:53:33Z', 'content': 'Regole per i commenti\r\nI commenti in questa pagina vengono controllati\r\nTi invitiamo ad utilizzare un linguaggio rispettoso e non offensivo, anche per le critiche più aspre\r\nIn particolare, durante l… [+413 chars]'}, {'source': {'id': None, 'name': 'Virgilio.it'}, 'author': 'Virgilio Sport', 'title': 'Serie A: va in scena il ballo delle punte - Virgilio Sport', 'description': 'Da Milik a Gervinho, passando per tanti altri bomber. Il mercato è dei re del gol.', 'url': 'https://sport.virgilio.it/serie-a-va-in-scena-il-ballo-delle-punte-667634', 'urlToImage': 'https://wips.plug.it/cips/sport.virgilio.it/cms/2020/12/milik-polonia_18pqrjuypj2o01m0dj1bvjvmd8.jpg?w=640&a=c&h=360', 'publishedAt': '2020-12-29T07:53:18Z', 'content': 'Il mercato invernale è pronto a regalarci tanti nuovi colpi. Diverse le squadre che puntano a migliorare le proprie rose durante la finestra di calciomercato di gennaio. I più ricercati? Quelli che f… [+1585 chars]'}, {'source': {'id': None, 'name': 'Orizzontescuola.it'}, 'author': 'https://www.facebook.com/acarlino85/', 'title': 'Vaccino Covid-19, Miozzo (CTS): “Per il personale scolastico deve essere obbligatorio” - Orizzonte Scuola', 'description': '"Medici, infermieri, personale sanitario: il vaccino anticovid deve essere obbligatorio. Lo stesso deve valere per chi lavora nelle Residenze sanitarie, dobbiamo difendere gli anziani".', 'url': 'https://www.orizzontescuola.it/vaccino-covid-19-miozzo-cts-per-il-personale-scolastico-deve-essere-obbligatorio/', 'urlToImage': 'https://www.orizzontescuola.it/wp-content/uploads/2020/12/Miozzo.png', 'publishedAt': '2020-12-29T07:41:00Z', 'content': '“Medici, infermieri, personale sanitario: il vaccino anticovid deve essere obbligatorio. Lo stesso deve valere per chi lavora nelle Residenze sanitarie, dobbiamo difendere gli anziani”.\r\nCosì in un’i… [+2173 chars]'}, {'source': {'id': None, 'name': 'Calciomercato.com'}, 'author': None, 'title': 'Zaniolo: “Vi svelo quando torno! Sì, ho fatto cavolate e ritardi. Roma? Non vado via, l’Inter mi ha…” - SOS Fanta', 'description': None, 'url': 'https://sosfanta.calciomercato.com/zaniolo-quando-torna-roma-inter-infortunio/', 'urlToImage': 'https://static-sosfanta.calciomercato.com/wp-content/uploads/2019/10/24193856/Zaniolo.jpg', 'publishedAt': '2020-12-29T07:00:00Z', 'content': 'Intervistato in esclusiva da\xa0La Gazzetta dello Sport,\xa0Nicolò Zaniolo dice tutto sul suo momento e sul rientro dall’infortunio. Ma c’è anche spazio per il futuro, la Roma, l’Inter e tanto altro nelle … [+351 chars]'}, {'source': {'id': None, 'name': 'Mediaset.it'}, 'author': None, 'title': 'Coronavirus, dal 7 gennaio tornano le restrizioni basate sui colori: Veneto e Puglia a rischio "zona arancione" - TGCOM', 'description': "Secondo l'ultimo bollettino dell'Iss, per la settimana 14-20 dicembre, sono però 9 le Regioni dove il pericolo è moderato o alto", 'url': 'https://www.tgcom24.mediaset.it/cronaca/coronavirus-dal-7-gennaio-tornano-le-restrizioni-basate-sui-colori-veneto-e-puglia-a-rischio-zona-arancione_27045408-202002a.shtml', 'urlToImage': 'https://img-prod.tgcom24.mediaset.it/images/2020/12/29/065133734-dba19e38-04cf-4f73-ba53-8f72a5758a3e.jpg', 'publishedAt': '2020-12-29T06:56:12Z', 'content': "Se infatti in queste due Regioni negli ultimi giorni i casi di contagio sono molto aumentati, già l'ultimo rapporto dell'Iss\xa0per la settimana 14-20 dicembre, sottolinea il Messaggero, aveva evidenzia… [+871 chars]"}, {'source': {'id': None, 'name': 'Soldionline.it'}, 'author': 'Mauro Introzzi', 'title': 'Borsa Italiana, il commento della seduta di oggi (29 dicembre 2020) - SoldiOnline.it', 'description': 'La cronaca della giornata di Borsa Italiana di oggi, martedì 29 dicembre 2020.', 'url': 'https://www.soldionline.it/notizie/azioni-italia/borsa-italiana-commento-giornata-29-dicembre-2020', 'urlToImage': 'https://www.soldionline.it/pictures/2019/08/12/borsa_milano.jpeg', 'publishedAt': '2020-12-29T06:56:00Z', 'content': "Avvio positivo, ma senza grandi variazioni, per l'Europa. A Piazza Affari occhi puntati su Atlantia, che ha definito inadeguata lofferta della cordata Cdp per l'88% di Aspi Avvio positivo, ma senza g… [+1878 chars]"}, {'source': {'id': None, 'name': 'Mediaset.it'}, 'author': None, 'title': 'Reporter senza Frontiere: 50 giornalisti uccisi durante il 2020 - TGCOM', 'description': 'Il Messico è il Paese che ha registrato il maggior numero di morti (8), seguito da India, Pakistan, Filippine e Honduras', 'url': 'https://www.tgcom24.mediaset.it/mondo/reporter-senza-frontiere-50-giornalisti-uccisi-durante-il-2020_27044591-202002a.shtml', 'urlToImage': 'https://img-prod.tgcom24.mediaset.it/images/2020/12/29/065009953-f2cb58d9-e3c9-48f0-a326-44f3a3546799.jpg', 'publishedAt': '2020-12-29T06:50:00Z', 'content': "Secondo Reporter senza Frontiere i giornalisti che quest'anno hanno perso la vita in Paesi non in guerra sono stati 34, pari al 68% del totale. La percentuale di giornalisti uccisi nelle zone di guer… [+1251 chars]"}, {'source': {'id': None, 'name': 'Rainews.it'}, 'author': None, 'title': 'Camera approva pacchetto di aiuti da 2.000 dollari per ogni americano - Rai News', 'description': 'Passa la linea dell\'"Helicopter money": finanziamenti a pioggia per aiutare la ripresa dell\'economia', 'url': 'http://www.rainews.it/dl/rainews/articoli/usa-pacchetto-assegni-a-pioggia-helicopter-money-2000-a0c176a2-07f7-4aad-a137-2640d23f0ff3.html', 'urlToImage': 'http://www.rai.it/cropgd/476x249/dl/img/2020/12/1609224314211.spesa_usa.jpg', 'publishedAt': '2020-12-29T06:43:00Z', 'content': '2020/12/29 07:43\r\n29 dicembre 2020Via libera dei democratici alla Camera in Usa ad assegni più alti da 2.000 dollari a testa agli americani per gli aiuti contro la pandemia, sulla scia della mossa de… [+3943 chars]'}, {'source': {'id': None, 'name': 'Lanazione.it'}, 'author': 'La Nazione', 'title': 'Covid Toscana, incognita maltempo sui vaccini ma si parte comunque in anticipo / LIVE - La Nazione', 'description': 'Il governatore: "In Toscana abbiamo deciso con forza di proteggere da subito i nostri nonni ospiti delle Rsa con il vaccino anticovid. Marco Meucci è il primo vaccinato della Rsa di Montedomini"', 'url': 'https://www.lanazione.it/cronaca/coronavirus-toscana-bollettino-covid-1.5857633', 'urlToImage': 'https://immagini.quotidiano.net/?url=http%3A%2F%2Fp1014p.quotidiano.net%3A80%2Fpolopoly_fs%2F1.5854281.1609189742%21%2FhttpImage%2Fimage.jpg_gen%2Fderivatives%2Fwidescreen%2Fimage.jpg&w=700&h=391', 'publishedAt': '2020-12-29T06:27:32Z', 'content': "Firenze, 29\xa0dicembre 2020 - La campagna vaccinale di massa contro il Covid in Toscana\xa0partirà in anticipo, anche se il maltempo potrebbe far slittare l'arrivo delle dosi attese. Comunque il calendari… [+12377 chars]"}, {'source': {'id': None, 'name': 'Corriere.it'}, 'author': 'Monica Guerzoni e Fiorenza Sarzanini', 'title': 'Zona arancione, cosa si può fare oggi 29 dicembre: le regole e spostamenti - Corriere della Sera', 'description': 'È il secondo dei tre giorni di «zona arancione» in tutta Italia, secondo quanto stabilito dal decreto Natale: dal 31 si torna in «zona rossa». Dalle visite agli amici alle regole per potersi spostare fuori dal comune, proviamo a vedere che cosa si può fare, o…', 'url': 'https://www.corriere.it/cronache/20_dicembre_29/zona-arancione-cosa-si-puo-fare-oggi-29-dicembre-regole-spostamenti-6a85a0e0-495d-11eb-922c-4ee9293ee215.shtml', 'urlToImage': 'https://images2.corriereobjects.it/methode_image/2020/12/28/Interni/Foto-Interni-Trattate/15221503522f16ba3710a535ce180da9-0042-kgKI-U32301143193395NvB-526x284@Corriere-Web-Sezioni.jpg', 'publishedAt': '2020-12-29T06:23:31Z', 'content': 'Secondo giorno di zona arancione in tutta Italia., secondo quanto stabilito dal decreto Natale varato dal governo. Nella giornata di oggi, 29 dicembre, sono ancora aperti i negozi — ma chiusi i bar e… [+4574 chars]'}, {'source': {'id': None, 'name': 'Corriere.it'}, 'author': 'Lorenzo Salvia', 'title': 'Vaccino Covid, se in primavera i numeri saranno bassi via all’obbligo per alcune categorie - Corriere della Sera', 'description': 'L’ipotesi sui tre milioni di statali, a partire da medici, infermieri e insegnanti. Si va verso la patente d’immunità per aerei, treni e spettacoli. Possibili meccanismi di incentivo ai lavoratori privati. «Ma parlarne oggi è una palla alzata ai no vax»', 'url': 'https://www.corriere.it/politica/20_dicembre_29/vaccino-covid-obbligo-28699fd2-4943-11eb-922c-4ee9293ee215.shtml', 'urlToImage': 'https://images2.corriereobjects.it/methode_image/2020/12/28/Politica/Foto-Politica-Trattate/16088910-0023-kuzD-U32301133533710H9C-526x284@Corriere-Web-Sezioni.jpg', 'publishedAt': '2020-12-29T06:18:30Z', 'content': 'Al di là delle parole di ministri e sottosegretari, al netto di quelli che a prima vista sembrano scontri, il percorso per la possibile obbligatorietà del vaccino contro il Covid è tracciato. Parlare… [+4176 chars]'}, {'source': {'id': None, 'name': 'Direttagoal.it'}, 'author': 'Nando Patanè', 'title': 'Sabrina Salerno con le trasparenze pericolose – FOTO - DirettaGoal', 'description': "Sabrina Salerno con le trasparenze pericolose. La foto con la camicia fa il pieno di like: in mostra c'è fin troppo.", 'url': 'https://news.direttagoal.it/non-solo-goal/sabrina-salerno-con-le-trasparenze-pericolose-foto/131215/', 'urlToImage': 'https://news.direttagoal.it/wp-content/uploads/2020/12/a9cfb934-d357-4056-9d7b-5b8fd6c3463c.jpg', 'publishedAt': '2020-12-29T06:04:00Z', 'content': 'Sabrina Salerno dimostra ancora una volta, qualora ce ne fosse stato bisogno, che l’età è solo un numero. A 52 anni il fisico è ancora da capogiro. Fan impazziti.\r\nDa Instagram\r\nSpecialmente dopo le … [+1086 chars]'}, {'source': {'id': None, 'name': 'Milanlive.it'}, 'author': None, 'title': 'Ibrahimovic, Milan-Juve a rischio | Ma c’è una buona notizia! - MilanLive.it', 'description': "La situazione infortunati in casa Milan. Poche possibilità di vedere Ibrahimovic contro la Juventus, ma c'è un'altra buona notizia per Pioli.", 'url': 'https://www.milanlive.it/2020/12/29/ibrahimovic-milan-juve-rischio-buona-notizia/', 'urlToImage': 'https://www.milanlive.it/wp-content/uploads/2020/11/Ibra-infortunio-2.jpg', 'publishedAt': '2020-12-29T06:02:07Z', 'content': 'La situazione infortunati in casa Milan. Poche possibilità di vedere Ibrahimovic contro la Juventus, ma c’è un’altra buona notizia per Pioli.\xa0\r\nZlatan Ibrahimovic (©Getty Images)\r\nIl Milan si ritrove… [+1458 chars]'}, {'source': {'id': 'il-sole-24-ore', 'name': 'Il Sole 24 Ore'}, 'author': 'Redazione', 'title': 'Smart working e congedi Covid, chi ne ha diritto e per quanto tempo - Il Sole 24 ORE', 'description': 'Le misure a beneficio di chi ha figli in età scolare si sono ampliate nel tempo. La fruizione è complicata a causa di decorrenze e requisiti stratificati', 'url': 'https://www.ilsole24ore.com/art/smart-working-e-congedi-covid-chi-ne-ha-diritto-e-quanto-tempo-ADGdJv8', 'urlToImage': 'https://i2.res.24o.it/images2010/2020/12/ADGdJv8/images/047e3f4c-4100-11eb-847a-c48101c9f287-fotohome0.jpg', 'publishedAt': '2020-12-29T05:57:47Z', 'content': "Covid, Inail: oltre 100mila i contagi sul lavoro e 366 decessi\r\n3' di lettura\r\nIl nuovo testo del decreto Ristori 1 licenziato dal Senato, che ingloba il Ristori bis, delinea si spera in modo definit… [+1702 chars]"}, {'source': {'id': None, 'name': 'Liberoquotidiano.it'}, 'author': '@libero_official', 'title': 'Grande Fratello Vip, la cannonata di Maria De Filippi: "Arrogante, sprezzante. Non mi piacevi. Ma poi..." - Liberoquotidiano.it', 'description': 'Alla diretta del Grande Fratello Vip su Canale 5 di lunedì 28 dicembre, il colpaccio di Alfonso Signorini si chiamava Maria De Filippi . P...', 'url': 'https://www.liberoquotidiano.it/news/spettacoli/televisione/25701025/grande-fratello-vip-maria-de-filippi-tommaso-zorzi-arrogante-spiazzante-non-mi-piacevi-poi-cambiato-idea.html', 'urlToImage': 'https://img2.liberoquotidiano.it/images/2020/12/29/055610075-9894fe01-aae8-446a-840e-a1f0b8877aba.jpg', 'publishedAt': '2020-12-29T05:53:00Z', 'content': 'Alla diretta del Grande Fratello Vip su Canale 5 di lunedì 28 dicembre, il colpaccio di Alfonso Signorini si chiamava Maria De Filippi. Prima storica ospitata per la conduttrice Mediaset al GfVip, do… [+1000 chars]'}, {'source': {'id': None, 'name': 'Corriere.it'}, 'author': 'Laura Zangarini', 'title': 'Usa, schiaffo a Trump: la Camera approva la legge sulla difesa - Corriere della Sera', 'description': 'La presidente della Camera Nancy Pelosi ha definito il veto al disegno di legge «un atto di sconcertante incoscienza». Ora il provvedimento passa al Senato: se approvato, sarebbe il primo override della presidenza Trump', 'url': 'https://www.corriere.it/esteri/20_dicembre_29/usa-schiaffo-trump-camera-approva-legge-difesa-7b23ca60-497d-11eb-922c-4ee9293ee215.shtml', 'urlToImage': 'https://images2.corriereobjects.it/methode_image/socialshare/2020/12/29/a99553e2-4981-11eb-922c-4ee9293ee215.jpg', 'publishedAt': '2020-12-29T03:05:29Z', 'content': 'La Camera Usa, controllata dai democratici, sfida il presidente Donald Trump e annulla il suo veto sulla legge sulla Difesa. Il provvedimento passa ora al Senato: se approvato da due terzi dei voti, … [+2019 chars]'}, {'source': {'id': None, 'name': 'Mediaset.it'}, 'author': None, 'title': 'Mario Ermito in mezzo a due fuochi - Grande Fratello VIP | GFVIP 5 - Grande Fratello', 'description': 'Uno scambio di messaggi tra Rosalinda e Mario solleva tanti dubbi tra gli inquilini', 'url': 'https://www.grandefratello.mediaset.it/news/mario-ermito-in-mezzo-a-due-fuochi_8813.shtml', 'urlToImage': 'https://www.grandefratello.mediaset.it/bin/articolo/76.$plit/C_18_articolo_8813_upiFotoApertura.jpg', 'publishedAt': '2020-12-28T23:24:00Z', 'content': 'La diretta della scorsa settimana ha creato una frattura netta e decisa tra Rosalinda Cannavò e Sonia Lorenzini e la causa è stata la Nomination dellattrice nei confronti della nuova entrata.Una scel… [+2000 chars]'}, {'source': {'id': None, 'name': 'Ilfattoquotidiano.it'}, 'author': 'RQuotidiano', 'title': 'In Edicola sul Fatto Quotidiano del 29 Dicembre: Il sig. Quindicipalle. “Ciao”, le bugie del guastatore - Il Fatto Quotidiano', 'description': 'Il sig. Quindicipalle. “Ciao”, le bugie del guastatore. Sceneggiata. Contesta il suo governo, ma tiene le poltrone. Mes, più debiti, jobs act, ponte sullo stretto e marchette', 'url': 'https://www.ilfattoquotidiano.it/2020/12/29/in-edicola-sul-fatto-quotidiano-del-29-dicembre-il-sig-quindicipalle-ciao-le-bugie-del-guastatore/6050033/', 'urlToImage': 'https://st.ilfattoquotidiano.it/wp-content/uploads/2020/12/29/variant-med_1200x630-obj22671751.jpg', 'publishedAt': '2020-12-28T23:12:09Z', 'content': 'Covid-19 \r\nTra negazionisti e furbastri\r\nLa polemica \r\nCè chi salta la fila \r\nIl dossier \r\nIl risiko delle Amministrative. Incastri. Il 2021 è lanno del voto nelle grandi città: i giallorosa cercano … [+2766 chars]'}, {'source': {'id': None, 'name': 'Smartworld.it'}, 'author': 'Vincenzo Ronca', 'title': 'La nuova modalità standby di Windows 10X renderà il vostro PC pronto all’azione come uno smartphone (foto) - SmartWorld', 'description': 'Windows 10X è una delle grandi novità attese per il 2021 da Microsoft, il sistema operativo appositamente concepito e sviluppato...', 'url': 'https://www.smartworld.it/informatica/la-nuova-modalita-standby-windows-10x-rendera-vostro-pc-pronto-allazione-uno-smartphone-foto.html', 'urlToImage': 'https://www.smartworld.it/wp-content/uploads/2020/02/windows-10x-darkmode.jpg', 'publishedAt': '2020-12-28T22:16:16Z', 'content': 'Vincenzo Ronca28/12/2020 ore 23:16Windows 10X è una delle grandi novità attese per il 2021 da Microsoft, il sistema operativo appositamente concepito e sviluppato per\xa0dispositivi\xa0pieghevoli\xa0e PC di\xa0g… [+1040 chars]'}, {'source': {'id': None, 'name': 'Ilfattoquotidiano.it'}, 'author': 'F. Q.', 'title': 'Cdp rivede al ribasso l’offerta per Autostrade e Atlantia la rifiuta ancora: “Inferiore alle… - Il Fatto Quotidiano', 'description': 'La Cassa e i partner Macquarie e Blackstone hanno ridotto la cifra messa sul piatto per l\'88% di Aspi e chiesto più garanzie. La due diligence comunque continuerà fino alla fine del mese prossimo. Il cda della holding: "Disponibilità a valutare un’eventuale o…', 'url': 'https://www.ilfattoquotidiano.it/2020/12/28/cdp-rivede-al-ribasso-lofferta-per-autostrade-e-atlantia-la-rifiuta-ancora-inferiore-alle-attese-tutto-rinviato-a-fine-gennaio/6049866/', 'urlToImage': 'https://st.ilfattoquotidiano.it/wp-content/uploads/2020/10/20/atlantia_1200.jpg', 'publishedAt': '2020-12-28T20:29:45Z', 'content': 'A due mesi dal rifiuto della prima offerta, il cda di Atlantia dice ancora no a Cassa depositi e prestiti nella trattativa per la cessione di Autostrade. La nuova offerta di Cdp e dei suoi partner Ma… [+3184 chars]'}]}
before: 123
before: 58
before: 105
before: 113
before: 119
{'status': 'ok', 'totalResults': 0, 'articles': []}
Traceback (most recent call last):
File "dashboard.py", line 144, in <module>
news_1 = d_n.get_news(NEWS_URL, NEWS_API, NEWS_SOURCES, NEWS_COUNTRY, 1, black)
File "/home/pi/dashboard/modules/db_news.py", line 46, in get_news
chk_str = int(len(str(n_data["articles"][x]["title"])))
IndexError: list index out of range
How I can go on? :smile:
yeah, but its supposed to work with the country based on your geolocation -this line {'status': 'ok', 'totalResults': 0, 'articles': []} is giving you the problem
-sorry, seeing the results now, can you comment back line 49 and uncomment line 48, print(x) -its weird that uncommenting line 18 is giving you the json information, it should give you the http link, did you uncomment this one (print(news_URL))
this is most likely gonna be a lot trial and error again, so hang tight
this is most likely gonna be a lot trial and error again, so hang tight
it is addicting! I really like this project and therefore the victory will be very enthusiastic! :v:
-its weird that uncommenting line 18 is giving you the json information, it should give you the http link, did you uncomment this one (print(news_URL))
Yes sorry! I'm just seeing if something were passed through the web server. So the problem is with the geolocalization API?
Uncomment the line 48:
pi@raspberrypi:~/dashboard $ python3 dashboard.py
Traceback (most recent call last):
File "dashboard.py", line 14, in <module>
from modules import db_news as d_n
File "/home/pi/dashboard/modules/db_news.py", line 48
print(x)
^
IndentationError: unexpected indent
I've putted a "print(geo_data)" in the dashboard.py file and I'm happy to see that the geolocalization works fine!
pi@raspberrypi:~/dashboard $ python3 dashboard.py
Initializing and clearing screen.
['Caraglio', '21', 'Italy', 44.4199, 7.4407, 'EUR', 'Euro', 'IT']
Traceback (most recent call last):
File "dashboard.py", line 144, in <module>
news_1 = d_n.get_news(NEWS_URL, NEWS_API, NEWS_SOURCES, NEWS_COUNTRY, 1, black)
File "/home/pi/dashboard/modules/db_news.py", line 46, in get_news
chk_str = int(len(str(n_data["articles"][x]["title"])))
IndexError: list index out of range
Caraglio is a little town nearby my home so it's ok! :smile:
for line 48 remove the space before the print so it can be at the same level of the line above chk_str_1
what about for the news_url that is printing from line 18? are you getting something like this https://newsapi.org/v2/top-headlines?country=it&apiKey=dfdsfngsdngodsnfisndi https://newsapi.org/v2/top-headlines?sources=ansa&apiKey=sddsffgfdhghgfhgf
with this code:
`def get_news(NEWS_URL, NEWS_API, NEWS_SOURCES, news_country, news_num, color):
if news_num == 0:
news_URL = str(NEWS_URL) + "country="+str(news_country).lower() + "&apiKey=" + str(NEWS_API)
elif news_num == 1:
news_URL = str(NEWS_URL) + "sources="+str(NEWS_SOURCES) + "&apiKey=" + str(NEWS_API)
print(news_URL)
error_connect = True
# print(news_URL)
while error_connect == True:
try:
# HTTP request
# print('Attempting to connect to OWM.')
response_n = requests.get(str(news_URL))
error_connect = None
except:
# Call function to display connection error
print('Connection error.')
# error_connect = None
# error = True
d_f.display_error(' NEWS CONNECTION', color)
# break
# delete the comment below
#
error = None
while error == None:
# Check status of code request
if response_n.status_code == 200:
# print('Connection to Open Weather successful.')
n_data = response_n.json()
#print(n_data)
news_items = []
for x in range(0, 5):
chk_str = int(len(str(n_data["articles"][x]["title"])))
chk_str_1 = chk_str print(x)
#print("before: " + str(chk_str))
# 43`
the result is:
pi@raspberrypi:~/dashboard $ python3 dashboard.py Traceback (most recent call last): File "dashboard.py", line 14, in <module> from modules import db_news as d_n File "/home/pi/dashboard/modules/db_news.py", line 18 print(news_URL) ^ IndentationError: unindent does not match any outer indentation level
print(news_URL) should be the same level as the elif above, back it a space
elif news_num == 1: news_URL = str(NEWS_URL) + "sources="+str(NEWS_SOURCES) + "&apiKey=" + str(NEWS_API) print(news_URL)
this line shoud be chk_str_1 = chk_str print(x)
Sorry, I'm really new with python code!
right, after the correction the result is:
pi@raspberrypi:~/dashboard $ python3 dashboard.py
Initializing and clearing screen.
https://newsapi.org/v2/top-headlines?country=it&apiKey=
0
1
2
3
4
https://newsapi.org/v2/top-headlines?sources=Rainews.it,Corriere.it,IlSole24Ore,Ilfattoquotidiano.it,Smartworld.it&apiKey=
Traceback (most recent call last):
File "dashboard.py", line 144, in <module>
news_1 = d_n.get_news(NEWS_URL, NEWS_API, NEWS_SOURCES, NEWS_COUNTRY, 1, black)
File "/home/pi/dashboard/modules/db_news.py", line 46, in get_news
chk_str = int(len(str(n_data["articles"][x]["title"])))
IndexError: list index out of range
I've manually deleted the API key but it's present!
dont worry, all good
so, it seems the country works fine, the problem its the sources, checking what the api can provide for Italy are these sources
https://newsapi.org/v2/sources?country=it&apiKey=
you can use https://jsonformatter.curiousconcept.com/ to give you a better look of the json data it throws you
check them with the link above and provide the id variable in the news sources field
i.e. ansa is good, for ilsore would be il-sole-24-ore
dont worry, all good
so, it seems the country works fine, the problem its the sources, checking what the api can provide for Italy are these sources
https://newsapi.org/v2/sources?country=it&apiKey=
you can use https://jsonformatter.curiousconcept.com/ to give you a better look of the json data it throws you
check them with the link above and provide the id variable in the news sources field
i.e. ansa is good, for ilsore would be il-sole-24-ore
Perfect! With your suggested site I've corrected all the ID for the news and now it works!!
Now the problem is:
pi@raspberrypi:~/dashboard $ python3 dashboard.py
Initializing and clearing screen.
https://newsapi.org/v2/top-headlines?country=it&apiKey=
0
1
2
3
4
https://newsapi.org/v2/top-headlines?sources=null,il-sole-24-ore,ansa&apiKey=
0
1
2
3
4
news charged at 11
News loaded
Weather loaded
Error in the HTTP WEATHER request.
Writing to screen.
Sleeping for 8 min.
Where I start to find the problem? :sunglasses:
in db_weather I've uncommented line 13 : print(W_URL)
....
news charged at 12
News loaded
Weather loaded
https://api.openweathermap.org/data/2.5/lat=44.4199&lon=7.4407&units=metric&appid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=hourly,minutely,alerts
cool, you can comment the lines back again
for the weather url in the web form should be https://api.openweathermap.org/data/2.5/onecall?
cool, you can comment the lines back again
print(x)
print(news_URL)
for the weather url in the web form should be https://api.openweathermap.org/data/2.5/onecall?
I've missing "onecall?" in the webserver now the weather works!!
Now I thinks the problems is with the JSON file of google:
pi@raspberrypi:~/dashboard $ python3 dashboard.py
Initializing and clearing screen.
news charged at 12
News loaded
Weather loaded
Please visit this URL to authorize this application: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" is a link to a web page that ask me to autorizate my google account to use my data. But when I accept the link I'm getting a error, the web page redirect me to: "localhost:57657/?state=xxxxxxxxxxxxxxxxxxxxxxxxxx"
When I've created the profile for the API I was declared that is for a "desktop application" is correct?
Is this for the calendar events or the task list?
Have a look in the wiki for the tutorials, sorry, I'm out for the day, will be back later if you still have the problems
For calendar, for now I'll not use the task list. The wiki about the calendar redirect at the google developer page. I'm made something to understand why I can go on with the authentication process.
Thanks for your help and support again!!
After a loooot of time and works finally here we are!!! :v: I'm working about the translation of the days, description, etc... I was thinking that changing the locale of raspberry the date/time was translated but is not enough, how I can translate it? :smile:
Thank you!
That's awesome, I'm glad it's finally working
For the translation part, whatever is not hard-coded we probably gonna have to build translation function for it
If everything is working fine besides that we can close this issue and create a new one called -translation to local language Or something like that and explain your request there
Yes of course! So thanks a lot for the help here and thanks in advance for the help for the translation part! I'm also excited for the arrival of the Spotify module in future! :wow:
See you on the other post!
Hi all! I'm tryng to start up the server. Where I read "your domain" in the instruction, I write local Ip (192.168.x.x) right? Or the public IP? Sorry but I don't know how to continue because when I write the local IP of the raspberry in the browser I see only the standard "NGINX presentation page" and nothing else. If I write my public IP address I see my modem router configuration page. Can someone help me?