Tive o mesmo problema do colega acima.. o airflow não esta reconhecendo a encriptação e consequentemente nas aulas posteriores estou tendo problemas de autenticação ao executar os códigos python... alguém chegou a conseguir resolver?
Tive o mesmo problema do colega acima.. o airflow não esta reconhecendo a encriptação e consequentemente nas aulas posteriores estou tendo problemas de autenticação ao executar os códigos python... alguém chegou a conseguir resolver?
código do erro que está sendo gerado la na frente:
2022-11-07 14:36:26,765] {base.py:68} INFO - Using connection ID 'twitter_default' for task execution.
[2022-11-07 14:36:26,768] {twitter_hook.py:35} 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,username,created_at
[2022-11-07 14:36:27,350] {http.py:142} ERROR - HTTP error: Unauthorized
[2022-11-07 14:36:27,352] {http.py:143} ERROR - {
"title": "Unauthorized",
"type": "about:blank",
"status": 401,
"detail": "Unauthorized"
}
Traceback (most recent call last):
File "/home/brunoaugp/datapipeline/.env/lib/python3.10/site-packages/airflow/providers/http/hooks/http.py", line 140, in check_response
response.raise_for_status()
File "/home/brunoaugp/datapipeline/.env/lib/python3.10/site-packages/requests/models.py", line 1022, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for 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,username,created_at
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/brunoaugp/datapipeline/airflow/plugins/operators/twitter_operator.py", line 56, in <module>
to.execute(None)
File "/home/brunoaugp/datapipeline/airflow/plugins/operators/twitter_operator.py", line 35, in execute
for pg in hook.run():
File "/home/brunoaugp/datapipeline/airflow/plugins/hooks/twitter_hook.py", line 53, in run
yield from self.paginate(url, session)
File "/home/brunoaugp/datapipeline/airflow/plugins/hooks/twitter_hook.py", line 44, in paginate
data = self.connect_to_endpoint(full_url, session)
File "/home/brunoaugp/datapipeline/airflow/plugins/hooks/twitter_hook.py", line 36, in connect_to_endpoint
return self.run_and_check(session,prep,{}).json()
File "/home/brunoaugp/datapipeline/.env/lib/python3.10/site-packages/airflow/providers/http/hooks/http.py", line 183, in run_and_check
self.check_response(response)
File "/home/brunoaugp/datapipeline/.env/lib/python3.10/site-packages/airflow/providers/http/hooks/http.py", line 144, in check_response
raise AirflowException(str(response.status_code) + ":" + response.reason)
airflow.exceptions.AirflowException: 401:Unauthorized