Answer the question
In order to leave comments, you need to log in
How to fix Python AttributeError: 'dict' object has no attribute 'vk_api' error?
I recently started learning Python, I'm trying to make a parser for id and the number of subscribers of VK groups
Code:
session = vk.Session(access_token = token)
vk_api = vk.API(session)
apivers = 5.92
def get_content():
name = input("Введите название групп: ")
groups = vk_api.groups.search(q = name, type = "group", v = apivers, city_id = 73, count = 1)
list = []
for group in groups:
list.append({
"id" : groups.vk_api.groups.getbyid('group_id'),
"subs" : groups.vk_api.groups.getbyid(fields = "members_count")
})
print(list)
print("--------------------------")
print(len(list))
return list
get_content()
Traceback (most recent call last):
File "d:/Programming/PY/base.py", line 35, in <module>
get_content()
File "d:/Programming/PY/base.py", line 23, in get_content
"id" : groups.vk_api.groups.getbyid('group_id'),
AttributeError: 'dict' object has no attribute 'vk_api'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question