mysolenso.services.me - User Profile

MySolenso user profile service.

Provides the MySolensoMe class, which queries the /fun_api_1_user_me endpoint and exposes the connected account’s information as Python properties.

This module is instantiated automatically by MySolenso and accessible via client.me.

Example

client = MySolenso(username="jdoe", token="tok")
print(client.me.name)
print(client.me.email)
print(client.me.group_name)
class mysolenso.services.me.MySolensoMe(parent)[source]

Bases: object

Access to the connected Solenso user account information.

Queries the API once at instantiation and caches the profile data. Properties are then available without any additional network call.

Parameters:

parent – Instance of MySolenso providing access to the auth sub-module (for session headers).

Raises:

MySolensoException – If the API response is invalid or if a network error occurs during initialisation.

parent

Reference to the parent MySolenso object.

Example

client = MySolenso(username="jdoe", token="tok")
me = client.me

print(me.username)    # "jdoe"
print(me.name)        # "John DOE"
print(me.email)       # "jdoe@jdoe.com"
print(me.phone)       # "+33600000000"
print(me.role_ids)    # "1"
print(me.roles_name)  # "Administrator"
print(me.group_name)  # "Install Solenso"
print(me.all_data)    # full dict returned by the API
property username: str

Login identifier (email address or username).

Returns:

Value of the user_name field returned by the API.

Return type:

str

property name: str

Full name of the user.

Returns:

Value of the name field returned by the API.

Return type:

str

property phone: str

Phone number associated with the account.

Returns:

Value of the phone field returned by the API, or an empty string if not set.

Return type:

str

property email: str

Email address of the account.

Returns:

Value of the email field returned by the API.

Return type:

str

property role_ids: str

Raw role identifier(s) assigned to the user.

Returns:

Value of the role_ids field returned by the API.

Return type:

str

property roles_name: str

Name of the first role assigned to the user.

Returns:

Value of the name field from the first element of roles.

Return type:

str

property group_name: str

Name of the group the user belongs to.

Returns:

Value of the name field from the group object.

Return type:

str

property all_data: dict

Full raw data returned by the API.

Useful for accessing fields not exposed by the other properties.

Example

{

“id”: 123456, “user_name”: “JDOE”, “type”: 3, “gid”: 234567, “name”: “John Doe”, “phone”: “+33600000000”, “email”: “jdoe@jdoe.com”, “role_ids”: [90], “identity”: 0, “src”: 0, “tid”: 197, “gpath”: “100267.100269.111139.136448”, “dc”: 0, “roles”: [

{

“name”: “Propriétaire”, “id”: 90, “v”: 0

}

], “group”: {

“id”: 987654, “name”: “Install Solenso”, “type”: 4

}, “services”: [

{

“gdpr”: 0

}

]

}

Returns:

Complete dictionary from the data field of the response.

Return type:

dict