How to use the easypost.User.retrieve function in easypost

To help you get started, we’ve selected a few easypost examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EasyPost / easypost-python / tests / test_user.py View on Github external
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'
github EasyPost / easypost-python / tests / test_user.py View on Github external
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'
github EasyPost / easypost-python / examples / user.py View on Github external
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)
github EasyPost / easypost-python / examples / user_api_keys.py View on Github external
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()
github EasyPost / easypost-python / examples / user.py View on Github external
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)
github EasyPost / easypost-python / examples / user.py View on Github external
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)