Skip to content

Auth

airvpn.web.auth

AuthUser

Bases: WebUser

Represents the currently logged-in AirVPN user.

Extends WebUser with authentication and account-management actions that require an active, authenticated session.

Attributes:

Name Type Description
session WebSession

The authenticated web session used for all requests made by this user.

api APIManager

Manager for the user's api keys.

ports PortManager

Manager for the user's forwarded ports.

devices DeviceManager

Manager for the user's devices.

sessions SessionManager

Manager for the user's active sessions.

dns DnsManager

Manager for the user's dns settings.

premium bool

Flag for if the user has a current plan.

name str

Your display name. Inherited from WebUser.

id int

User's ID. Inherited from WebUser.

image str

URL of the user's profile image. Inherited from WebUser.

profile_url str

Full URL to the user's profile page. Inherited from WebUser.

content_count int | None

Number of content items (posts) the user has made. Inherited property from WebUser.

followers int | None

Number of followers the user has. Inherited property from WebUser.

community_reputation int | None

The user's community reputation score. Inherited property from WebUser.

rank str | None

Display name of the user's rank. Inherited property from WebUser.

joined datetime | None

Date and time the user joined. Inherited property from WebUser.

last_visited datetime | None

Date and time of the user's last visit. Inherited property from WebUser; lazily fetched via profile scrape if not already known.

about About | None

The user's "About" information. Inherited property from WebUser.

gender str | None

The user's disclosed gender. Inherited property from WebUser.

location str | None

The user's disclosed location. Inherited property from WebUser.

interests str | None

The user's disclosed interests. Inherited property from WebUser.

about property

About | None: The user's "About" information, including detailed rank data and birthday.

api property

APIManager: Manager for the user's api keys

community_reputation property

int | None: The user's community reputation score.

contacts property

Contacts | None: The user's contact methods.

content_count property

int | None: Number of content items (posts) the user has made.

devices property

DeviceManager: Manager for the user's devices

dns property

DnsManager: Manager for the user's dns settings

followers property

int | None: Number of followers the user has.

gender property

str | None: The user's disclosed gender.

image property

str: The user's profile picture.

inbox property

InboxManager: Manger for the user's inbox

interests property

str | None: The user's disclosed interests.

joined property

datetime | None: Date and time the user joined.

last_visited property

datetime | None: Date and time of the user's last visit.

location property

str | None: The user's disclosed location.

ports property

PortManager: Manager for the user's forwarded ports.

rank property

str | None: Display name of the user's rank, as shown in the profile header.

sessions property

SessionManager: Manager for the user's sessions.

edit_profile(birthday: datetime = None, website: str = None, twitter: str = None, mastodon: str = None, aim: str = None, msn: str = None, icq: str = None, yahoo: str = None, xmpp: str = None, skype: str = None, gender: str = None, location: str = None, interests: str = None, about_me: str = None, profile_privacy: ProfilePrivacy = None) -> bool

Edit the authenticated user's profile.

Fetches the profile edit form to determine current values and the CSRF token, then submits an update to the profile with the given fields. Any argument left as None falls back to the current value already on the form or on the user object (and ultimately to an empty string, ProfilePrivacy.ALL, or a zeroed-out datetime for birthday), so only the fields the caller wants to change need to be supplied.

Parameters:

Name Type Description Default
birthday datetime

New birthday to set. Defaults to the user's current about.birthday, or datetime(0, 0, 0) if unset.

None
website str

New personal website URL.

None
twitter str

New Twitter/X handle.

None
mastodon str

New Mastodon handle.

None
aim str

New AIM contact identifier.

None
msn str

New MSN contact identifier.

None
icq str

New ICQ contact identifier.

None
yahoo str

New Yahoo contact identifier.

None
xmpp str

New XMPP/Jabber contact identifier.

None
skype str

New Skype contact identifier.

None
gender str

New disclosed gender.

None
location str

New disclosed location.

None
interests str

New disclosed interests.

None
about_me str

New "About Me" text. Defaults to the current value.

None
profile_privacy ProfilePrivacy

New ProfilePrivacy setting controlling who can view the profile. Defaults to the currently selected option on the edit form, or ProfilePrivacy.ALL if none is selected.

None

Returns:

Name Type Description
bool bool

True if the update request succeeded (HTTP 200 or 301), False otherwise.

follow() -> bool

Follow this member.

Returns:

Name Type Description
bool bool

True if the request succeeded.

get_unread_notifications() -> tuple[list[Notification], list[Message]]

Retrieves a list of unread notifications and messages for the authenticated user.

Returns:

Type Description
tuple[list[Notification], list[Message]]

tuple[list[Notification], list[Message]]: A tuple containing two lists: - A list of Notification objects representing unread notifications. - A list of Message objects representing unread messages.

login(username: Optional[str] = None, password: Optional[str] = None, remember_me: bool = False, session_key: Optional[str] = None)

Login to the AirVPN website.

Parameters:

Name Type Description Default
username str

Account username or email address.

None
password str

Account password.

None
rememeber_me bool

Whether or not to store the session's credentials.

required
session_key str

The value from AuthUser.get_session_key()

None

Raises:

Type Description
LoginError

If the login request does not redirect away from the login page (indicating invalid credentials or a failed login attempt).

unfollow() -> bool

Unfollow the user.

Returns:

Name Type Description
bool bool

True if the request succeeded.

update()

Force update attributes.