Ainda não tem acesso? Estude com a gente! Matricule-se
Ainda não tem acesso? Estude com a gente! Matricule-se
2
respostas

Erro HTTPSConnectionPool(host='api.twitter.com', port=443): Max retries exceeded

Alguém já viu esse erro?

(.env) daleffi@DESKTOP-4N4M1M8:~/datapipeline/airflow/plugins/hooks$ python twitter_hook.py
[2022-04-19 22:36:54,455] {base_hook.py:89} INFO - Using connection to: id: twitter_default. Host: https://api.twitter.com, Port: None, Schema: None, Login: None, Password: None, extra: XXXXXXXX
[2022-04-19 22:36:54,456] {twitter_hook.py:18} INFO - URL: https://api.twitter.com/2/tweets/search/recent?query=AluraOnline&tweet.fields=author_id,conversation_id,created_at,id,in_reply_to_user_id,public_metrics,text&expansions=author_id&user.fields=id,name,created_at
[2022-04-19 22:37:00,704] {http_hook.py:185} WARNING - HTTPSConnectionPool(host='api.twitter.com', port=443): Max retries exceeded with url: /2/tweets/search/recent?query=AluraOnline&tweet.fields=author_id,conversation_id,created_at,id,in_reply_to_user_id,public_metrics,text&expansions=author_id&user.fields=id,name,created_at (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe28be2e310>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) Tenacity will retry to execute the operation
Traceback (most recent call last):
  File "/home/daleffi/datapipeline/.env/lib/python3.8/site-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/home/daleffi/datapipeline/.env/lib/python3.8/site-packages/urllib3/util/connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

2 respostas

Estou com um erro similar:

[2022-04-21 12:55:10,683] {base_hook.py:89} INFO - Using connection to: id: twitter_default. Host: https://api.twitter.com, Port: None, Schema: None, Login: None, Password: None, extra: XXXXXXXX [2022-04-21 12:55:10,684] {twitter_hook.py:37} INFO - URL: https://api.twitter.com/2/tweets/search/recent?query=AluraOnline&tweet.fields=author_id,conversation_id,created_at,id,public_metrics,text&expansions=author_id&user.fields=id,name,username,created_at /home/lucas/Documents/datapipeline/.env/lib/python3.8/site-packages/urllib3/connectionpool.py:981: InsecureRequestWarning: Unverified HTTPS request is being made to host 'api.twitter.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( Traceback (most recent call last): File "twitter_hook.py", line 60, in print(json.dumps(pg, ident=4, sort_keys=True)) File "/usr/lib/python3.8/json/init.py", line 234, in dumps return cls( TypeError: init() got an unexpected keyword argument 'ident'

A quem possa interessar:

Está dando erro de timeout pois a máquina virtual não estava resolvendo nome via DNS. Eu uso o linux Ubuntu virtualizado no windows 10 via WSL (Windows subsystem for linux). Ocorre que o arquivo etc/resolv.conf sobe por padrão com o DNS errado. Editei o arquivo colocando o DNS do Google (8.8.8.8) e tudo funcionou. Demorou mas achei!!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software