def add_credentials(request, api_id, viewer_id, sid, secret): credentials = VKCredentials(api_id, viewer_id, secret, sid) credentials.test() if not credentials.is_valid(): return {'errors': ['Credentials seems to be broken']} collection = VKCredentialsCollection(settings.VK_CREDENTIALS_FILE_PATH) collection.add_new_tested_credentials(credentials) collection.dump_to_disk() return {}
def delete_credentials(request, viewer_id, api_id): collection = VKCredentialsCollection(settings.VK_CREDENTIALS_FILE_PATH) collection.remove_credentials_by_viewer(viewer_id, api_id) collection.dump_to_disk() return {}