Botometer Pro

부분 유료
분류별 Observatory on Social Media | 업데이트됨 14 giorni fa | Social
인기

9.2 / 10

지연 시간

1,213ms

서비스 수준

100%

Health Check

N/A

모든 토론으로 돌아가기

Running Botometer gets interrupted with an error

Rapid account: Itspatrickchoi
itspatrickchoi
un anno fa

Hi, I have a problem using the Botometer API.
While checking and collecting the Botometer scores, eventually there is an error, after 164 or 260 results, even though the limit should be 2000 per day…

My code:
bom = botometer.Botometer(
wait_on_ratelimit=True, rapidapi_key=rapidapi_key, **twitter_app_auth
)

df = pd.read_csv(“csv_files/tweets_musk_twitter_til_oct20.csv”)

desired_users = (
df[df[“Date”] == “2022-04-25”]
.drop_duplicates(subset=[“User”])
.User.head(2000)
.tolist()
)

results = []

datetime_start = datetime.datetime.now()
print(datetime_start)

for user in desired_users:
try:
result = bom.check_account(user)
except:
print(user + " doesn’t exist anymore")
continue
else:
# print(user)
result = bom.check_account(user)
print(result[“raw_scores”][“english”][“overall”])
results.append([user, result[“raw_scores”][“english”][“overall”]])
# print(results)

So that would get me a list of users and their scores in a list where I would then separate them into bots and non_bots. But while this is running, it eventually gets interrupted…

This is the error message:
Traceback (most recent call last):
File “C:\Users\profp\Documents\Dokumente Asus TUF\Programming stuff\Python stuff\Botometer\botometer_test.py”, line 260, in <module>
result = bom.check_account(user)
File “C:\Python310\lib\site-packages\botometer_init_.py”, line 127, in check_account
payload = self.get_twitter_data(user,
File "C:\Python310\lib\site-packages\botometer_init
.py", line 77, in _get_twitter_data
user_timeline = self.twitter_api.user_timeline(
File “C:\Python310\lib\site-packages\tweepy\binder.py”, line 253, in _call
return method.execute()
File “C:\Python310\lib\site-packages\tweepy\binder.py”, line 234, in execute
raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: [{‘message’: ‘Internal error’, ‘code’: 131}]

Could you tell me how I fix this? Thank you very much!
Rapid account: Itspatrickchoi
itspatrickchoi Commented un anno fa

Hi, I see, thank you for the reply!
But the error happens on this line:
"try:
result = bom.check_account(user)"
Right?
If so, then I already am trying to prevent an error by “try and except”, no? Or how should I prevent this? That would be very helpful, thank you!

Best,
Patrick

Rapid account: O So Me
OSoMe Commented un anno fa

Thanks for using our tool!

The error message suggests that the error happens when the Botometer-python packages tries to fetch data from Twitter’s API. I tried to Google this error but didn’t find much useful information. One theory is that this is related to https://twitter.com/elonmusk/status/1592177471654604800 . Unfortunately, there is not much we can do about it.

One thing you can try is to catch this error, wait for, say 5 mins, and try again to see if it helps.

–Botometer Team

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입