-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Python Question #8
Comments
Try to load the profile with a try-catch statement. If you catch an exception you can check for the error. If the returned HTTP Status Code is 409 (Conflict - already loaded), then you can delete it and load again.
|
To check if a configuration file has been deleted from Kameleo during the last script execution, you can perform the following steps:
Here is an example to perform these steps using the Kameleo API in Python: import requests
def check_and_delete_configuration(configuration_id):
# Retrieve the list of available configurations
response = requests.get('https://kameleo.local/api/v1/configurations')
configurations = response.json()
# Check if the desired configuration is present
for config in configurations:
if config['id'] == configuration_id:
# Delete the configuration
requests.delete(f'https://kameleo.local/api/v1/configurations/{configuration_id}')
print('Configuration deleted.')
# Reload the configuration for further use
reload_configuration(configuration_id)
break
else:
print('Configuration not found.')
def reload_configuration(configuration_id):
# Your code to reload the configuration file goes here
pass
# Call the function with the desired configuration ID
check_and_delete_configuration('12345') Make sure to replace |
So I am trying to use Kameleo in my python script that goes to a website and logs into it. I am saving the profile and then loading back when executing the script next time. I want a functionality check if the profile was deleted from Kameleo during the last execution of the script and if it still exists then the script will first delete it and then load it again...
The text was updated successfully, but these errors were encountered: