Olá Rafel!
Peguei o código no seguinte link: https://github.com/alura-cursos/alura-data-pipeline/tree/Aula-2
Quando executo o twitter_hook.py retorna o seguinte erro:
Traceback (most recent call last):
File "twitter_hook.py", line 60, in <module>
for pg in TwitterHook("AluraOnline").run():
File "twitter_hook.py", line 53, in run
session = self.get_conn()
File "/Users/ralph/anaconda3/lib/python3.8/site-packages/airflow/providers/http/hooks/http.py", line 72, in get_conn
conn = self.get_connection(self.http_conn_id)
File "/Users/ralph/anaconda3/lib/python3.8/site-packages/airflow/hooks/base.py", line 63, in get_connection
conn = Connection.get_connection_from_secrets(conn_id)
File "/Users/ralph/anaconda3/lib/python3.8/site-packages/airflow/models/connection.py", line 354, in get_connection_from_secrets
raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined")
airflow.exceptions.AirflowNotFoundException: The conn_id `twitter_default` isn't defined
Tentei comentar somente o "or "twitter_default"" na linha 10, mas retornou o seguinte erro:
Traceback (most recent call last):
File "twitter_hook.py", line 60, in <module>
for pg in TwitterHook("AluraOnline").run():
File "twitter_hook.py", line 57, in run
yield from self.paginate(url, session)
File "twitter_hook.py", line 46, in paginate
data = self.connect_to_endpoint(full_url, session)
File "twitter_hook.py", line 36, in connect_to_endpoint
prep = session.prepare_request(response)
File "/Users/ralph/anaconda3/lib/python3.8/site-packages/requests/sessions.py", line 449, in prepare_request
p.prepare(
File "/Users/ralph/anaconda3/lib/python3.8/site-packages/requests/models.py", line 314, in prepare
self.prepare_url(url, params)
File "/Users/ralph/anaconda3/lib/python3.8/site-packages/requests/models.py", line 388, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid 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,username,created_at': No schema supplied. Perhaps you meant http:///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,username,created_at?
Desde já agradeço.