Network configurations

If you have an unstable connection, sometimes you might want to overwrite the defaults of the RequestsSettings. These settings will propagate to the Project and Dataset objects that are created from the EncordUserClient.

# Import dependencies
from encord.user_client import EncordUserClient
from encord.http.constants import RequestsSettings

#Authenticate using the path to your private key
user_client = EncordUserClient.create_with_ssh_private_key(ssh_private_key_path='<private_key_path>')

You can also overwrite the timeouts for reads and write operations. To overwrite the read, write, and connect timeout, do the following:

# Import dependencies
from encord import EncordUserClient
from encord.http.constants import RequestsSettings

# Replace the number 300 with the number of seconds you want to set the timeout to
NEW_TIMEOUT = 300

requests_settings = RequestsSettings(
    connect_timeout=NEW_TIMEOUT,
    read_timeout=NEW_TIMEOUT,
    write_timeout=NEW_TIMEOUT,
)

#Authenticate using the path to your private key
user_client = EncordUserClient.create_with_ssh_private_key(ssh_private_key_path='<private_key_path>')