API Reference

Intra

class etnapy.Intra

Represents the ETNA intranet. This class give functions for getting various information on the intranet.

etna_login

str – The login of the user connected.

is_logged

bool – A boolean to know if an user is connected.

login(user, password)

Establish a connection with the intranet.

Parameters:
  • user (str) – The username.
  • password (str) – The password.
Returns:

A json dict with some information about the user. Prefer the method user_info() for getting user information. Return Returns None if the connection failed.

Return type:

dict or None

keep_alive(func)

A simple decorator to make sure you’re always connected.

keep_alive_async(func)

A simple decorator to make sure you’re always connected. This one accept and only accept asynchronous coroutines.

user_info(user_login=None)

Get information about an user.

Parameters:user_login (Optionnal[str]) – The user login. If no login provided the current connected user will be used.
Returns:The user object containing the formatted information. None if an error occured.
Return type:User or None
user_avatar(user_login=None)

Get the raw bytes of the user avatar.

Parameters:user_login (Optionnal[str]) – The user login. If no login provided the current connected user will be used.
user_promo(user_login=None)

Get information about an user’s promotion.

Parameters:user_login (Optionnal[str]) – The user login. If no login provided the current connected user will be used.
Returns:A list of promotion objects containing the formatted information. None if an error occured.
Return type:list of Promo or None
walls_list()

Get all the connected user’s walls.

Returns:A list of walls name. None if an error occured.
Return type:list of str or None
wall_messages(wall_name, start, stop)

Get wall’s messages.

Parameters:
  • wall_name (str) – The name of the wall.
  • start (int) – The start index of the messages. Start from 0.
  • stop (int) – The stop index of the messages.
Returns:

A json object of the messages.

Return type:

dict or None

user_trophy(user_login=None)

Get user’s trophy.

Parameters:user_login (Optionnal[str]) – The user login. If no login provided the current connected user will be used.
Returns:The list of Trophy objects.
Return type:list of Trophy or None
trophy_picture(id_trophy)

Get a tuple with the URL of the trophy avatar and the raw content (bytes) of the avatar.

Parameters:id_trophy (int) – The unique ID of a trophy.
logout()

Log out from the intranet.

User

class etnapy.User(json_data)

Represents an user on the intranet. This class parse and give formatted information about an user.

id

int – The internal unique ID of the user.

login

str – The unique login (username) of the user.

firstname

str – The first name of the user.

lastname

str – The last name of the user.

email

str – The ETNA email of the user.

close

bool – An boolean to know if the account of the user is closed.

closed_at

Optional[datetime.datetime] – The date of closure of the account if it took place.

roles

list of str – The roles of the user.

created_at

datetime.datetime – The date of creation of the account.

updated_at

datetime.datetime – The date of the last update of the account.

deleted_at

Optional[datetime.datetime] – The date of deletion of the account if the account has been deleted.

identity

A property that returns the first name and last name with a space between.

Promo

class etnapy.Promo(json_data)

Represents an promotion on the intranet. This class parse and give formatted information about an promotion.

id

int – The internal unique ID of the promotion.

target_name

str – The full name of the promotion.

term_name

str – The name and month of the promotion.

learning_start

datetime.datetime – The start date of the promotion.

learning_end

datetime.datetime – The end date of the promotion.

learning_duration

int – The duration of the promotion in days.

promo

str – The year of the promotion.

spe

str – The speciality of promotion.

wall_name

str – The name of the wall associated with the promotion.

Trophy

class etnapy.Trophy(json_data)

Represents an trophy on the intranet. This class parse and give formatted information about an trophy.

id

int – The internal unique ID of the trophy.

name

str – The name of the trophy.

description

str – The description of the trophy.

type

str – The type of the trophy.

image_url

str – The URL of the trophy’s image.

achieved_at

datetime.datetime – The date of presentation of the trophy.