0
respostas

Erro ao executar twitter_hook.py

Bom dia!

Eu tento executar o twitter_hook.py através da venv, dentro da pasta DataPipeline. Entretanto, ele dá esse seguinte erro (bem grande, por sinal): Eu criei a conexão dentro do Airflow, então não acho que esse seja o problema.

[2022-02-18 13:10:55,728] {connection.py:344} ERROR - Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/airflow/models/connection.py", line 342, in extra_dejson
    obj = json.loads(self.extra)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
[2022-02-18 13:10:55,728] {connection.py:345} ERROR - Failed parsing the json for conn_id twitter_default
[2022-02-18 13:10:55,729] {twitter_hook.py:36} 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
/usr/local/lib/python3.8/dist-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(
[2022-02-18 13:10:55,928] {http_hook.py:150} ERROR - HTTP error: Unauthorized
[2022-02-18 13:10:55,928] {http_hook.py:151} ERROR - {
  "title": "Unauthorized",
  "type": "about:blank",
  "status": 401,
  "detail": "Unauthorized"