models.Users

pykechain.models.User

class User(json, **kwargs)[source]

A virtual object representing a KE-chain user.

Variables
  • username – username of the user

  • name – username of the user (compatibility)

  • id – userid of the user

  • timezone – timezone of the User (defaults to <UTC>)

  • language – language of the User (defaults to ‘en’)

  • email – email of the User (defaults to ‘’)

Construct a user from provided json data.

property default_name: str

Get default name, prioritizing the user name over the KE-chain name.

Returns

Name

:rtype str

property timezone: BaseTzInfo

Timezone of the user.

Defaults to timezone UTC. With return a pytz timezone eg. ‘Europe/Amsterdam’

Returns

timezone object (compatible with datetime)

Return type

TzInfo

property language: str

Language code of the user.

Defaults to English (‘en”) when no language code is configured.

Returns

language code string

Return type

basestring

property email: str

Email of the user.

Returns

email address, default is empty string.

Return type

basestring

reset_password() None[source]

Send a request password link to the email of the user.

curl ‘https://pim3-test.ke-chain.com/accounts/password/reset/’ –data-raw ‘{“email”:”hostmaster+newuser@ke-works.com”}’

now_in_my_timezone() datetime[source]

Get current time in the timezone of the User.

Defaults to timezone GMT+1 (Europe/Amsterdam).

Returns

Current datetime

:rtype datetime.datetime