Botometer Pro

FREEMIUM
От Observatory on Social Media | Обновлено 14 days ago | Social
Популярность

9.2 / 10

Задержка

1,213ms

Уровень обслуживания

100%

Health Check

N/A

Назад ко всем обсуждениям

HTTPError: 401 Client Error: Unauthorized for url:

Rapid account: Lonihagen
lonihagen
a year ago

It works fine with checking one or two accounts:
result = bom.check_account(’@clayadavis’)

However, when I read a list of twitter accounts, that looks lie below, it gives me 401 Client Error:
0 unwomenindia
1 SkyNews
2 Jerusalem_Post
3 gujratsamachar
4 nayibbukele

52955 me_kimba
52956 Yelix
52957 herculezg
52958 malcolmkenyatta
52959 ainsleyoc
Name: user_screen_name, Length: 52960, dtype: object

Just to note, I have Check accounts in bulk and Check account v4. When run “Test Endpoint”, Check accounts in bulk gives 401 Client Error. Check account v4 runs without error. Can you please advise?

Rapid account: O So Me
OSoMe Commented a year ago

Glad to hear that it works now.

Rapid account: Lonihagen
lonihagen Commented a year ago

Ok, the same script runs now. It seems like that Botometer side server is not stable, so it throws 401 error once in a while (irregularly). Thanks so much for responding to me though…

Rapid account: Lonihagen
lonihagen Commented a year ago

My guess is that your API key has been suspended by Twitter. We are sorry about that. ==> No, it works now. So, this cannot be it.

The check accounts in bulk error might be due to that you haven’t subscribed to the corresponding plan. ==> Does this mean that this could cause the 401 error? If so, can you guide me which subscription is necessary to activate this?

Rapid account: Lonihagen
lonihagen Commented a year ago

OK, now I’ve run the couple of accounts successfully using your example code:

Check a single account by screen name

result = bom.check_account(’@clayadavis’)

Check a single account by id

result = bom.check_account(1548959833)
print(result)

Check a sequence of accounts

accounts = [’@clayadavis’, ‘@onurvarol’]
for screen_name in accounts:
result = bom.check_account(screen_name)
print(result)

But I still have the 401 error from the first line of the following code:

FYI: “list of handels” include values like this: [’@unwomenindia’, ‘@SkyNews’, ‘@Jerusalem_Post’, ‘@gujratsamachar’, ‘@nayibbukele’, ‘@ThaiPBSNews’, …]


for screen_name, result in bom.check_accounts_in(list_of_handles):
print(_index)
if(‘user’ not in list(result.keys())):
print(result)
if (‘error’ in list(result.keys())):
if ‘34’ in result[‘error’] :
data = {
‘userID’: ‘none’,
‘username’: list_of_handles[_index],
‘cap_universal’: -1,
‘status’: “deleted”
}
df = pd.DataFrame(data, index=[_index])
list_of_df.append(df)
_index = _index + 1
else:
data = {
‘userID’: ‘none’,
‘username’: list_of_handles[_index],
‘cap_universal’: -1,
‘status’: “suspended”
}
df = pd.DataFrame(data, index=[_index])
list_of_df.append(df)
_index = _index + 1
else:
data = {
‘userID’: result[‘user’][‘user_data’][‘id_str’],
‘username’: list_of_handles[_index],
‘cap_universal’: result[‘cap’][‘universal’],
‘status’: “active”
}
df = pd.DataFrame(data, index=[_index])
list_of_df.append(df)
_index = _index + 1

current_date = str(datetime.datetime.today()).split()[0]
final = pd.concat(list_of_df)
final.to_csv(‘botometer/botometer_output/verified_bots/verified_bots_{}.csv’.format(current_date))

Rapid account: O So Me
OSoMe Commented a year ago

My guess is that your API key has been suspended by Twitter. We are sorry about that.

The check accounts in bulk error might be due to that you haven’t subscribed to the corresponding plan.

–Botometer

Rapid account: O So Me
OSoMe Commented a year ago

401 error usually indicates that your API key has been deactivated. Please make sure you still have access to the V1.1 API of Twitter.

Also, it would be helpful if you could share the full code snippet you used when you encountered the error. It’s hard to tell what went wrong with the information you provided.

–Botometer Team

Присоединяйтесь к обсуждению – добавьте комментарий ниже:

Войдите / Зарегистрируйтесь, чтобы публиковать новые комментарии