-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
twarc2 search without configure on Windows throws JSON parse error #441
Comments
i think this query is missing a space, it should be Another issue may be the
Does that give the same error? |
I noticed the missing space too. I couldn't get it to throw the same error though. Maybe it's a Windows only behavior? Does anyone else with access have time to confirm? |
I saw this error before from someone else, and the issue was a failing connection to the API, solved with setting alternative DNS servers, |
Yes it still does unfortunately. I am really stucked, don't know what to do |
to run other simple commands like; |
I have tried all the suggestions from @igorbrigadir and @edsu, yet, i get the error response: raise JSONDecodeError("Expecting value", s, err.value) from None |
Interesting! @osemele can you paste the last 20 lines or so of your twarc.log file. You should find the file in the directory where you are running your twarc command? |
If errors from the Twitter API are not JSON they can cause strange errors. Instead we should catch these and log what was received from Twitter instead of JSON. Refs #441
Also, I've just released twarc v2.0.7 that should log what was received from the Twitter API when an error message is not JSON. Could you try installing it with |
Thinking about @igorbrigadir's point about DNS I'd also be interested to see if the v1.1 API is working. Can you try the older twarc client and see what happens?
Note twarc instead of twarc2. |
twarc search blacklivesmatter
works perfectly. Every other search on twarc work for me.
twarc search #EndSARS > tweets222.json
also worked perfectly and a file was saved from it.
but all searches on twarc2 give the error message. for instance a simple
command of: "twarc2 search blacklivesmatter" pops the following error:
Traceback (most recent call last):
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\twarc\decorators.py",
line 179, in __call__
result = e.response.json()
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\requests\models.py",
line 900, in json
return complexjson.loads(self.text, **kwargs)
File
"C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\json\__init__.py",
line 346, in loads
return _default_decoder.decode(s)
File
"C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\json\decoder.py",
line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File
"C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\json\decoder.py",
line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
I have also upgraded twarc using pip3 install --upgrade twarc to get
v2.0.8, yet, gets the same error message
…On Sun, Apr 25, 2021 at 12:22 PM Ed Summers ***@***.***> wrote:
Thinking about @igorbrigadir <https://github.com/igorbrigadir>'s point
about DNS I'd also be interested to see if the v1.1 API is working. Can you
try the older twarc client and see what happens?
twarc search blacklivesmatter
Note twarc instead of twarc2.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6B3CGFVUOUOJIU7OK3TKP3PHANCNFSM43M324CA>
.
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
Strange, I thought I was catching JSONDecodeError in v2.0.7 and up. What do you see when you run this:
|
twarc2 is finally not running at all again.
to run 'twarc2' and 'twarc2 version' I get the response 'failed to create
process.'.
meanwhile, twarc is still running perfectly.
what can i do now?
…On Mon, Apr 26, 2021 at 3:08 PM Ed Summers ***@***.***> wrote:
Strange, I thought I was catching JSONDecodeError in v2.0.8. What do you
see when you run this:
twarc2 version
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6DMLJ5VKZLCKUUU7RLTKVXT7ANCNFSM43M324CA>
.
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
If twarc works, but twarc2 does not, I would first check if the app is setup for v2 access on https://developer.twitter.com/en/portal/dashboard - and if that's correct (the app should be under "Academic Research" Project, not "Standard") try this command, replacing
If that fails, something else is wrong. If you do not have Academic Access, you will not be able to use
If those work, but twarc2 still does not, I would recommend reinstalling twarc, or trying it in a brand new vitrualenv environment:
Another thing i found, is that maybe there is a space in your user name, and your Anaconda / pip is broken as a result: https://stackoverflow.com/questions/42152589/anaconda-failed-to-create-process |
I've been meaning to check what happens when you use --archive with keys that don't have access to the Academic Product Track. If that really is the cause here I think twarc2 should give an understandable error. |
@osemele can you please paste the full stack trace you see when you run |
C:\Users\USER>twarc2 search '#blacklivesmatter'
Traceback (most recent call last):
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\twarc\decorators.py",
line 179, in __call__
result = e.response.json()
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\requests\models.py",
line 900, in json
return complexjson.loads(self.text, **kwargs)
File
"C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\json\__init__.py",
line 346, in loads
return _default_decoder.decode(s)
File
"C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\json\decoder.py",
line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File
"C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\json\decoder.py",
line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\runpy.py",
line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\runpy.py",
line 87, in _run_code
exec(code, run_globals)
File
"C:\Users\USER\PycharmProjects\main2projects\venv\Scripts\twarc2.exe\__main__.py",
line 7, in <module>
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\click\core.py",
line 829, in __call__
return self.main(*args, **kwargs)
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\click\core.py",
line 782, in main
rv = self.invoke(ctx)
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\click\core.py",
line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\click\core.py",
line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\click\core.py",
line 610, in invoke
return callback(*args, **kwargs)
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\click\decorators.py",
line 33, in new_func
return f(get_current_context().obj, *args, **kwargs)
File
"c:\users\user\pycharmprojects\main2projects\venv\lib\site-packages\twarc\decorators.py",
line 187, in __call__
except JSONDecodeError:
NameError: name 'JSONDecodeError' is not defined
…On Wed, Apr 28, 2021 at 1:29 AM Ed Summers ***@***.***> wrote:
@osemele <https://github.com/osemele> can you please paste the full stack
trace you see when you run twarc2 version ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6FH2S3ZY7BPCRJA6W3TK5JFJANCNFSM43M324CA>
.
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
@osemele I accidentally introduced a new error when trying to catch the one you found earlier. Could you upgrade twarc to v2.0.9 and try your twarc2 command again and paste any errors you see? |
Thank you sir. I just upgraded to v2.0.9.
However, a simple command of twarc2 search '#blacklivesmatter' gives this
error:
Unable to parse error as JSON, received:
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…On Thu, Apr 29, 2021 at 12:47 PM Ed Summers ***@***.***> wrote:
@osemele <https://github.com/osemele> I accidentally introduced a new
error when trying to catch the one you found earlier. Could you upgrade
twarc to v2.0.9 and try your twarc2 command again and paste any errors you
see?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6FW7535TMA5W4ZDIM3TLFBMVANCNFSM43M324CA>
.
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
Thanks! This is making sense to me now - It appears that AVG is blocking or redirecting requests to |
Thank you so much for all the efforts and responses, What if I totally
uninstall AVG from my system. Will that work?
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…On Thu, Apr 29, 2021 at 3:29 PM Igor Brigadir ***@***.***> wrote:
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Virus-free.
www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Thanks! This is making sense to me now - It appears that AVG is blocking
or redirecting requests to api.twitter.com. You will need to configure
AVG to allow connections to twitter, or allow twarc2.exe or something like
that - i don't know AVG settings, but that's the source of your error,
which was hidden by our JSONDecode bug.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6FGRYXUVXSY62WTYMDTLFULZANCNFSM43M324CA>
.
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
I have totally uninstalled AVG from my system but twarc2 still gives this
error. kindly see attached screenshot sir.
On Thu, Apr 29, 2021 at 4:23 PM Kingsley OGUNNE ***@***.***>
wrote:
… Thank you so much for all the efforts and responses, What if I totally
uninstall AVG from my system. Will that work?
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_-6322445360901552343_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Thu, Apr 29, 2021 at 3:29 PM Igor Brigadir ***@***.***>
wrote:
>
> http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
> Virus-free.
> www.avg.com
>
> http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> Thanks! This is making sense to me now - It appears that AVG is blocking
> or redirecting requests to api.twitter.com. You will need to configure
> AVG to allow connections to twitter, or allow twarc2.exe or something like
> that - i don't know AVG settings, but that's the source of your error,
> which was hidden by our JSONDecode bug.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#441 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ATRWO6FGRYXUVXSY62WTYMDTLFULZANCNFSM43M324CA>
> .
>
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
This is just for reference but @igorbrigadir is doing some fine detective work on this over in the Twitter Forum: https://twittercommunity.com/t/mining-historical-data-using-twarc/153350/13 |
@osemele what is AVG? Can you try to reinstall twarc with this command and see if twarc2 works?
|
I have upgraded to twarc 2.0.10
however, a simple twarc2 search gives the response:
⚡ Unable to parse error as JSON, received:
…On Thu, Apr 29, 2021 at 5:36 PM Ed Summers ***@***.***> wrote:
@osemele <https://github.com/osemele> what is AVG? Can you try to
reinstall twarc with this command and see if twarc2 works?
python -m pip install --upgrade --force-reinstall twarc
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6BPRYEZX7KIYY6OTH3TLGDITANCNFSM43M324CA>
.
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
And what's the exact command you're running and where (Anaconda prompt? cmd.exe?) What does
output? |
The sample requests i made on cmd.exe are: twarc2 search endsars
twarc2 search '#endsars' --archive
it then returns the error message: Unable to parse error as JSON, received:
The 'pip list' gives a list of the python packages on my computer. Inside
it, there is 'twarc 2.0.10'
Below is the full list:
C:\Users\USER>pip list
Package Version
------------------- ---------
anyio 2.2.0
argon2-cffi 20.1.0
async-generator 1.10
atomicwrites 1.4.0
attrs 20.3.0
Babel 2.9.0
backcall 0.2.0
bleach 3.3.0
certifi 2020.12.5
cffi 1.14.5
chardet 4.0.0
click 7.1.2
click-config-file 0.6.0
click-plugins 1.1.1
colorama 0.4.4
configobj 5.0.6
cycler 0.10.0
decorator 5.0.7
defusedxml 0.7.1
deprecation 2.1.0
entrypoints 0.3
idna 2.10
iniconfig 1.1.1
ipykernel 5.5.3
ipython 7.22.0
ipython-genutils 0.2.0
jedi 0.18.0
Jinja2 2.11.3
json5 0.9.5
jsonschema 3.2.0
jupyter-client 6.1.12
jupyter-core 4.7.1
jupyter-packaging 0.9.2
jupyter-server 1.6.4
jupyterlab 3.0.14
jupyterlab-pygments 0.1.2
jupyterlab-server 2.4.0
kiwisolver 1.3.1
MarkupSafe 1.1.1
matplotlib 3.4.1
mistune 0.8.4
mpmath 1.2.1
nbclassic 0.2.7
nbclient 0.5.3
nbconvert 6.0.7
nbformat 5.1.3
nest-asyncio 1.5.1
notebook 6.3.0
numpy 1.20.2
oauthlib 3.1.0
packaging 20.9
pandas 1.2.4
pandocfilters 1.4.3
parso 0.8.2
pickleshare 0.7.5
Pillow 8.2.0
pip 21.1
pluggy 0.13.1
prometheus-client 0.10.1
prompt-toolkit 3.0.18
py 1.10.0
pycparser 2.20
Pygments 2.8.1
pyparsing 2.4.7
pyrsistent 0.17.3
pytest 6.2.3
python-dateutil 2.8.1
python-dotenv 0.17.0
pytz 2021.1
pywin32 300
pywinpty 0.5.7
pyzmq 22.0.3
requests 2.25.1
requests-oauthlib 1.3.0
Send2Trash 1.5.0
setuptools 56.0.0
six 1.15.0
sniffio 1.2.0
sympy 1.8
terminado 0.9.4
testpath 0.4.4
toml 0.10.2
tomlkit 0.7.0
tornado 6.1
traitlets 5.0.5
twarc 2.0.10
urllib3 1.26.4
wcwidth 0.2.5
webencodings 0.5.1
wheel 0.36.2
…On Fri, Apr 30, 2021 at 11:43 AM Igor Brigadir ***@***.***> wrote:
And what's the exact command you're running and where (Anaconda prompt?
cmd.exe?)
What does
pip list
output?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6GQZ6Q6PD7HV7ZESHTTLKCULANCNFSM43M324CA>
.
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
And what does this output? (Replacing
and
You may also have to replace |
for the first curl i got this response:
https://gist.github.com/igorbrigadir/b0c8eb60e2a1353be7bf6c28d7357258#file-1-md
|
Yeah, a 400 error from the API is documented as:
and then suggest:
But we're not actually sending any JSON as part of the search/recent API call it's just a GET. I guess if we set logging.level to DEBUG we might get some underlying information from requests/urllib3? --log-level might actually be a nice option to have... But I agree @igorbrigadir it seems like something is interfering with the execution of twarc2.exe? I don't know how feasible it is, but it might be nice to be able to run twarc2 like this:
|
This is a special appreciation to you both for your constant support and
perseverance. I am so glad to inform you that my twarc2 now works and
generates data. I can't thank you enough sirs, as all your responses were
useful. I sincerely appreciate your patience.
For the records, I think the improper configuration of the twarc2 (in
addition to the twarc configuration) contributed to the reasons for getting
those errors.
I will begin to work on twarc2 for my archival data collection now. I will
be so glad if you would come to my rescue if problems arise.
Thank you once again for the support.
…On Wed, May 5, 2021 at 6:32 PM Ed Summers ***@***.***> wrote:
Yeah, a 400 error from the API is documented
<https://developer.twitter.com/en/support/twitter-api/error-troubleshooting#http-status-codes>
as:
The request was invalid or cannot be otherwise served. An accompanying
error message will explain further. Requests without authentication or with
invalid query parameters are considered invalid and will yield this
response.
and then suggest:
Double check the format of your JSON query. For example, if your rule
contains double-quote characters associated with an exact-match or other
operator, you may need to escape them using a backslash to distinguish them
from the structure of the JSON format.
But we're not actually sending any JSON as part of the search/recent API
call it's just a GET. I guess if we set logging.level to DEBUG we might get
some underlying information
<https://stackoverflow.com/questions/16337511/log-all-requests-from-the-python-requests-module>
from requests/urllib3? --log-level might actually be a nice option to
have...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6HBBPD7HMHPABYHBIDTMF6KJANCNFSM43M324CA>
.
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
@osemele that is awesome news! Do you know what you did to fix it? It would be useful for us to know if this situation ever arises again. |
Yes, I think all this while I never knew I didn't configure my twarc2
properly.
First, I thought since I had configured twarc, that that would suffice for
twarc2
Second, the error messages I was getting on twarc2 were not pointing
towards issues of none/poor configuration. It never directly mentioned
authorization as a problem, hence, my attention never went to configuration
problems.
Again, whenever I made attempts to configure my twarc2, it never displayed
the bearer token, API secret and token secret on my screen while pasting
it. So in most cases, I abruptly discontinued the process until I read
somewhere that not displaying such secret keys and tokens was the normal
process of configuring twarc2.
I think those getting similar errors to mine, especially when the python
environment has properly been created should also look into their twarc2
configuration specifically.
Thank you once again.
…On Fri, May 7, 2021 at 12:18 PM Ed Summers ***@***.***> wrote:
@osemele <https://github.com/osemele> that is awesome news! Do you know
what you did to fix it? It would be useful for us to know if this situation
ever arises again.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6DVW5GJDOCLKPQUYZ3TMPEALANCNFSM43M324CA>
.
--
Kingsley Oladayo Ogunne
Department of Corporate Services
Obafemi Awolowo University Teaching Hospitals Complex
P.M.B. 5538
Ile-Ife, Nigeria
Telephone: +2348088444325, +2349050054242
|
That's very helpful thanks @osemele . We will test running |
Maybe we could try and read the old |
Yeah, that would be nice if it wasn't too tricky. Do the old stand-alone apps have access to the Twitter v2 API? I guess it is confusing for someone might concurrently use twarc and twarc2. I wanted to update twarc2 to allow for "profiles" like twarc. |
Not by default, but, the same keys work for both "Profiles" sound like a good feature for sure. |
Do you find my suggestion on configuring twarc2 separately to avoid error
useful?
…On Mon, May 10, 2021, 11:39 AM Igor Brigadir ***@***.***> wrote:
Do the old stand-alone apps have access to the Twitter v2 API?
Not by default, but, the same keys work for both v1.1 and v2, if the app
is set up in a Project on the dashboard -
https://developer.twitter.com/en/portal/projects-and-apps so we could
link that in a "warning" when loading configs this way maybe?
"Profiles" sound like a good feature for sure.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6ADVWNB5KTUBIH2N5LTM6ZXHANCNFSM43M324CA>
.
|
Yes very! Thanks again for digging in with the debugging! |
This also has me wondering if the input should actually display the keys on the console. It seems to be causing some confusion. |
It's not really clear to me that the configuration was actually the root of the problem here. We are seeing the AVG firewall issue coming up in #469 as well. |
Hi @edsu, not sure if this thread is still running. I am facing a similar issue as @osemele, "unable to parse 400 error as json: Bad request" with twarc2. I have been able to successfully configure twarc2 as well as twarc, so the above-suggested fix does not work for me. twarc runs perfectly for me, but twarc2, unfortunately, does not. When I run the command: twarc2 stream blm > tweets.json1, it creates a file "tweets" but without any data. I have tried installing, uninstalling Anaconda, Python, etc., but unfortunately, nothing has worked so far. I also tried on a computer where the username does not have any space in it to avoid the pip breaking down, but that did not seem to be the problem as well. I am sorry for the long post, but I can't seem to find the fix while twarc2 seems to do exactly what I need which is why I really want it to work. |
@AbirRes thank you for the details! Can you say what operating system + version you are using as well as what version of Python you have installed and where you got it from? |
@edsu I am using Windows 10 and python 3.9.5. I downloaded it from their official website. I also tried it after downloading Anaconda, where then I used the Anaconda prompt to run the commands. Furthermore, I followed the usual/suggested install methods and did not do anything custom to change the path, etc. |
It is very interesting that twarc works but twarc2 does not. Can you share which commands were you using for each? |
I have only tried the basic commands so far. I have tried: twarc search #covid; twarc filter #covid; twarc trends. For twarc2, I have tried twarc2 stream #covid19; twarc2 stream blm; twarc2 stream blm > tweets.json1. All give "unable to parse json" error, but the latter one creates an empty tweets folder. |
Kindly check the command over again. It should be tweets.jsonl not
tweets.json1. As in, letter "L" for Lion, and not figure 1.
…On Wed, Jun 9, 2021, 12:49 PM AbirRes ***@***.***> wrote:
I have only tried the basic commands so far. I have tried: twarc search
#covid; twarc filter #covid; twarc trends. For twarc2, I have tried twarc2
stream #covid19; twarc2 stream blm; twarc2 stream blm > tweets.json1. All
give "unable to parse json" error, but the latter one creates an empty
tweets folder.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATRWO6GMSLWCMXK2W3WOKMTTR5IMZANCNFSM43M324CA>
.
|
I get the message: Unable to parse 400 error as JSON: Bad Request. I am sorry, I can't post a snapshot as I am not in front of my system right now. |
This commit adds twarc.config.ConfigProvider which is based on click_config_file.configobj_provider and stores the file path for the config file that was used. This is useful for logging. Also when --verbose is used the log will now contain the keys that are being used to talk to the API. This isn't something you would normally want in your logs, but it can be useful for debugging situations like #441 and #469.
@AbirRes v2.1.4 of twarc was just released, which has some improved logging. Would you be willing to upgrade:
and then run a search with verbose logging:
Then can you email me your twarc.log at ehs@pobox.com? You should see the IMPORTANT! Please understand that |
@AbirRes thanks for sending the twarc.log file. I responded with an email asking if you would be willing to run |
Oh, and the reason why twarc was working but twarc2 was not is that they actually use separate configuration files. Eventually the twarc one will go away when the v1.1 API endpoint is retired. |
With @AbirRes' help we were able to figure out that the bearer token was not persisted to the configuration file correctly. It was a ctrl-v character, which seemed to really confuse the Twitter API. I think the ctrl-v ended up in the configuration file because we were previously hiding the input of the token (for screen recording). It could be that some Windows terminals aren't set up to do ctrl-v properly, and users could not see that it wasn't working since it was hidden. Tokens should now appear in the console to help catch this in the future. So if you have this problem, please make sure you are using twarc v2.1.5 or higher:
and then reconfigure twarc2:
Hopefully that will allow you to use twarc2 subcommands going forwards. Thanks for everyone's patience on this! |
Don't do that again |
I ran the request below:
twarc2 search '#ENDSARS-is:retweet' --start-time 2017-12-01 --end-time 2020-11-30 --flatten --archive C:\Users\USER\Desktop\MyTwarcResults.json
and I got this error message below:
What exactly be the cause/source of this error, and how can i get help?
The text was updated successfully, but these errors were encountered: