mirror of
https://github.com/SantaSpeen/anixart.git
synced 2026-10-12 03:24:10 +00:00
[~] Промежуточный вариант
This commit is contained in:
+15
-5
@@ -1,9 +1,19 @@
|
|||||||
from anixart import AnixartAPI, AnixartUserAccount, PROFILE
|
from anixart import AnixartAPI, AnixartAccount
|
||||||
|
from anixart import endpoints
|
||||||
|
from anixart.exceptions import AnixartAPIRequestError
|
||||||
|
from anixart.profile import Profile
|
||||||
|
|
||||||
user = AnixartUserAccount("SantaSpeen", "I_H@ve_Very_Secret_P@ssw0rd!")
|
anix = AnixartAPI() # По умолчанию используется гость
|
||||||
anix = AnixartAPI(user)
|
|
||||||
|
|
||||||
|
# acc = AnixartAccount("SantaSpeen", "I_H@ve_Very_Secret_P@ssw0rd!")
|
||||||
|
# # id у аккаунта появляется только после
|
||||||
|
# anix.use_account(acc)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
me = anix.execute("GET", PROFILE.format(user.id))
|
try:
|
||||||
print(me.json())
|
raw = anix.execute("GET", endpoints.PROFILE.format(1))
|
||||||
|
profile = {"is_my_profile": raw['is_my_profile'], **raw['profile']}
|
||||||
|
print(Profile(**profile))
|
||||||
|
except AnixartAPIRequestError as e:
|
||||||
|
print(e.message)
|
||||||
|
print(e.code)
|
||||||
|
|||||||
Reference in New Issue
Block a user