Skip to content
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

[FIX] Twitter: adapt to APIv2 #780

Merged
merged 2 commits into from
Mar 29, 2022
Merged

Conversation

PrimozGodec
Copy link
Collaborator

Issue
Description of changes
Includes
  • Code changes
  • Tests
  • Documentation

@PrimozGodec PrimozGodec force-pushed the fix-twitter branch 2 times, most recently from a52f973 to 4992143 Compare March 11, 2022 16:59
@ajdapretnar
Copy link
Collaborator

There are some things that need to be fixed here:

  1. When opening the widget, it already contains the query "orange". Is this intended? I was hoping more for a placeholder than an actual pre-set query.
  2. I enter the bearer token and run the query with the default settings. Nothing happens. The search is complete, but there is no output.
  3. I then changed the language to English. Ran the search. The widget crashes with:
Traceback (most recent call last):
  File "/Users/ajda/orange/orange3/Orange/widgets/utils/concurrent.py", line 591, in _on_task_done
    super()._on_task_done(future)
  File "/Users/ajda/orange/orange3/Orange/widgets/utils/concurrent.py", line 547, in _on_task_done
    self.on_exception(ex)
  File "/Users/ajda/orange/orange3-text/orangecontrib/text/widgets/owtwitter.py", line 278, in on_exception
    raise ex
  File "/Users/ajda/.pyenv-x86/versions/3.9.10/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/ajda/orange/orange3-text/orangecontrib/text/widgets/owtwitter.py", line 37, in search
    return api.search_content(
  File "/Users/ajda/orange/orange3-text/orangecontrib/text/twitter.py", line 154, in search_content
    corpus, count = self._fetch(build_query(), max_tweets, callback=callback)
  File "/Users/ajda/orange/orange3-text/orangecontrib/text/twitter.py", line 215, in _fetch
    for i, response in enumerate(paginator):
  File "/Users/ajda/.pyenv-x86/versions/py3.9/lib/python3.9/site-packages/tweepy/pagination.py", line 98, in __next__
    response = self.method(*self.args, **self.kwargs)
  File "/Users/ajda/.pyenv-x86/versions/py3.9/lib/python3.9/site-packages/tweepy/client.py", line 907, in search_recent_tweets
    return self._make_request(
  File "/Users/ajda/.pyenv-x86/versions/py3.9/lib/python3.9/site-packages/tweepy/client.py", line 118, in _make_request
    response = self.request(method, route, params=request_params,
  File "/Users/ajda/.pyenv-x86/versions/py3.9/lib/python3.9/site-packages/tweepy/client.py", line 88, in request
    raise BadRequest(response)
tweepy.errors.BadRequest: 400 Bad Request
There were errors processing your request: missing EOF at '-' (at position 10)
  1. After the crash, the search doesn't stop. The button resets to Search, but the progress bar is still running.
  2. When the crash happens, a standard Orange error window opens. The major issue here is that the bearer token is also displayed. It is also probably sent together with the error message, if the user reports it. This should not happen.

@PrimozGodec PrimozGodec force-pushed the fix-twitter branch 3 times, most recently from 0813356 to 6be96a3 Compare March 21, 2022 08:19
@ajdapretnar
Copy link
Collaborator

Trying to download tweets from Orange, I get two errors:
With @OrangeDataMiner

Api error (400 Bad Request
There were errors processing your request: no viable alternative at input '@OrangeDataMiner' (at position 6))

With OrangeDataMiner
Api error ('NoneType' object is not iterable)

Before there was a check that every author search had to start with @, if I am not mistaken, otherwise an error would appear.

@codecov-commenter
Copy link

codecov-commenter commented Mar 25, 2022

Codecov Report

Merging #780 (0e2a409) into master (7fb74de) will decrease coverage by 0.03%.
The diff coverage is 95.74%.

❗ Current head 0e2a409 differs from pull request most recent head 5b37c41. Consider uploading reports for the commit 5b37c41 to get more accurate results

@@            Coverage Diff             @@
##           master     #780      +/-   ##
==========================================
- Coverage   75.00%   74.97%   -0.04%     
==========================================
  Files          75       75              
  Lines       10231    10189      -42     
  Branches     1635     1626       -9     
==========================================
- Hits         7674     7639      -35     
- Misses       2300     2302       +2     
+ Partials      257      248       -9     

@PrimozGodec PrimozGodec force-pushed the fix-twitter branch 5 times, most recently from 87235d3 to bfb72fc Compare March 25, 2022 13:55
@PrimozGodec PrimozGodec marked this pull request as ready for review March 25, 2022 14:01
@PrimozGodec
Copy link
Collaborator Author

@ajdapretnar I hope it is done now. :P If you find any other case to cower I can add that.

@ajdapretnar
Copy link
Collaborator

I found some small issues, but I would not like to further block this great fix, so I'll merge and open another issue.

@ajdapretnar ajdapretnar merged commit 4a28f85 into biolab:master Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants