Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error_msg = 'Child users must be created via the API and must not contain an email or password.'
assert exception['error']['message'] == error_msg
assert exception['error']['code'] == 'USER.INVALID'
child_id = child_user.id
assert child_id is not None
retrieved_user = easypost.User.retrieve(child_id)
assert retrieved_user.id == child_id
assert retrieved_user.name == 'Python All-Things-Testing'
new_name = 'Python All-Things-Tested'
retrieved_user.name = new_name
retrieved_user.save()
updated_user = easypost.User.retrieve(child_id)
assert updated_user.id == child_id
assert updated_user.name == 'Python All-Things-Tested'
with pytest.raises(easypost.Error) as caught_exception:
easypost.User.create(
name='Python All-Things-Testing',
password='super-secret-password',
password_confirmation='super-secret-password'
)
exception = caught_exception.value.json_body
error_msg = 'Child users must be created via the API and must not contain an email or password.'
assert exception['error']['message'] == error_msg
assert exception['error']['code'] == 'USER.INVALID'
child_id = child_user.id
assert child_id is not None
retrieved_user = easypost.User.retrieve(child_id)
assert retrieved_user.id == child_id
assert retrieved_user.name == 'Python All-Things-Testing'
new_name = 'Python All-Things-Tested'
retrieved_user.name = new_name
retrieved_user.save()
updated_user = easypost.User.retrieve(child_id)
assert updated_user.id == child_id
assert updated_user.name == 'Python All-Things-Tested'
import easypost
easypost.api_key = 'PRODUCTION API KEY'
me = easypost.User.retrieve()
child_user = easypost.User.create(
name='Python All-Things-Testing',
phone_number='555-555-5555'
)
id = child_user.id
retrieved_user = easypost.User.retrieve(id)
new_name = 'Python All-Things-Tested'
retrieved_user.name = new_name
retrieved_user.save()
updated_user = easypost.User.retrieve(id)
import easypost
easypost.api_key = 'PRODUCTION API KEY'
# Here are two different ways to retrieve your api_keys
api_keys = easypost.User.all_api_keys()
my_keys1 = api_keys.keys
me = easypost.User.retrieve()
my_keys2 = me.api_keys()
# Here is how to retrieve the api_keys of a child user
child = me.children[0]
child_keys = child.api_keys()
me = easypost.User.retrieve()
child_user = easypost.User.create(
name='Python All-Things-Testing',
phone_number='555-555-5555'
)
id = child_user.id
retrieved_user = easypost.User.retrieve(id)
new_name = 'Python All-Things-Tested'
retrieved_user.name = new_name
retrieved_user.save()
updated_user = easypost.User.retrieve(id)
import easypost
easypost.api_key = 'PRODUCTION API KEY'
me = easypost.User.retrieve()
child_user = easypost.User.create(
name='Python All-Things-Testing',
phone_number='555-555-5555'
)
id = child_user.id
retrieved_user = easypost.User.retrieve(id)
new_name = 'Python All-Things-Tested'
retrieved_user.name = new_name
retrieved_user.save()
updated_user = easypost.User.retrieve(id)