Skip to main content

Official Blaugue API package

Project description

Documentation:

Basic usage:

from blaugue.api import Blaugue

blaugueAPI = Blaugue(email='armand@camponovo.xyz', password='password')

search = blaugueAPI.search('query') # search 'query'
results = search.results # all results
for i in results:
    print(f'Object {i.__class__.__name__}') # print class name of result i
users = blaugueAPI.all_users()
for i in users:
    print(i.name)

Chat usage:

from blaugue.api import Blaugue

api = Blaugue(email='armand@camponovo.xyz', password='password')

chats = api.get_chats() # get all chats and return BlaugueChat() list

for chat in chats:
    print(chat.name) # print chat name
    for message in chat.messages:
        if chat.id == 'blaugue':  # all of users are in this chat, message.receiver will return a list
            print(message.author.name)
            print([user.name for user in message.receiver])  # print list of string of usernames
        else:
            print(message.author.name)
            print(message.receiver.name)
    print('\n\n')

Type variables:

If you use an intelligent ide, type your variables to improve coding experience

from blaugue.user import BlaugueUser
from blaugue.post import BlauguePost
from blaugue.tag import BlaugueTag
from blaugue.api import Blaugue
from blaugue.chat import BlaugueChat, BlaugueMessage

api = Blaugue(email='armand@camponovo.xyz', password='password')

search = api.search('armand')

posts = search.posts_results
post: BlauguePost
users = search.users_results
user: BlaugueUser
tags = search.tags_results
tag: BlaugueTag
chat: BlaugueChat
message: BlaugueMessage

for post in posts:
    print(post.title)

for tag in tags:
    print(tag.name)

for user in users:
    print(user.name)

for chat in api.get_chats():
    print(chat.name)
    for message in chat.messages:
        print(message.author.name)

Classes:

blaugue.api.Blaugue():

init:

Blaugue(email='you@email.com', password='12345')

methods:

search(self, query): return BlaugueResults() of query
get_user(self, email): return BlaugueUser() of email
get_post(self, post_id): return BlauguePost() of post id
get_lasts_post(self): return list of BlauguePost() of last ten posts
get_chats(self): return list of BlaugueChat() of all chats (can be accessed by connected user)
get_chat(self, chat_id): return BlaugueChat() object of chat
all_users(self): return list of BlaugueUser() of all users

properties:

None: return None

blaugue.search.BlaugueResults():

init:

BlaugueResults(infos, super)

methods:

None: return None

properties:

results: return a list of BlaugueUser() / BlauguePost() / BlaugueTag() objects
json_results: return a json with results
users_results: return a list of BlaugueUser() objects
posts_results: return a list of BlauguePost() objects
tags_results: return a list of BlaugueTag() objects


blaugue.user.BlaugueUser():

init:

BlaugueUser(infos, super)

methods:

None: return None

properties:

name: return str of user's name
id: return str of user's id
avatar: return str of user's avatar url
premium: return bool (True if user is premium, False else)
premium_icon: return str of user's premium icon url
bot: return bool (True if user is a bot, False else)
badges: return list of user's badges
description: return str of user's description
url: return str of user's profil url


blaugue.post.BlauguePost():

init:

BlauguePost(infos, super)

methods:

None: return None

properties:

title: return str of post's title
subtitle: return str of post's subtitle
html_content: return str of post's html_content
markdown_content: return str of post's markdown_content
image: return str of post's cover image url
book: return str of post's book url
id: return str of post's id
url: return str of post's url
author: return BlaugueUser() of post's author
type: return BlaugueTag() of post's tag / type
comments: return list of dict of post's comments


blaugue.tag.BlaugueTag():

init:

BlaugueTag(infos, super)

methods:

None: return None

properties:

name: return str of tag's name
posts: return list of BlauguePost() of tag's posts
url: return str of tag's url


blaugue.chat.BlaugueChat():

init:

BlaugueChat(infos, super)

methods:

None: return None

properties:

name: return str of chat's name
id: return str of chat's id (can be used to get a chat)
messages: return list of BlaugueMessage() objects


blaugue.chat.BlaugueMessage():

init:

BlaugueMessage(infos, super, chat)

methods:

None: return None

properties:

html_content: return str of message's html content (with < br > and &nbsp ;)
content: return str of message's content (without < br > and &nbsp ;)
author: return BlaugueUser() object of message's author
receiver: return BlaugueUser() object of message's receiver (list of if chat is the common chat)


Get information about connected account:

from blaugue.api import Blaugue

blaugueAPI = Blaugue(email='armand@camponovo.xyz', password='password')

# check if account has been connected
if bool(blaugueAPI):
    print('Account informations are right !')

# get name of connected account
print(str(blaugueAPI))
    
# get token of connected account
print(next(blaugueAPI))

# get bytes of hash of password of current account
print(bytes(blaugueAPI))

# get BlaugueUser() object of connected account
connected = blaugueAPI.connected
print(connected.name)
print(connected.avatar)
print(connected.premium_icon)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blaugue-0.0.4.tar.gz (6.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page