mirror of
https://github.com/deesiigneer/pyspapi.git
synced 2026-04-20 04:25:25 +00:00
new version
This commit is contained in:
15
examples/get_user.py
Normal file
15
examples/get_user.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from pyspapi import SPAPI
|
||||
from asyncio import get_event_loop
|
||||
|
||||
spapi = SPAPI(card_id='CARD_ID', token='TOKEN')
|
||||
|
||||
|
||||
async def main():
|
||||
user = await spapi.get_user(262632724928397312)
|
||||
print(user.username, user.uuid)
|
||||
for card in user.cards:
|
||||
print(card.name, card.number)
|
||||
|
||||
|
||||
loop = get_event_loop()
|
||||
loop.run_until_complete(main())
|
||||
12
examples/me.py
Normal file
12
examples/me.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from pyspapi import SPAPI
|
||||
from asyncio import get_event_loop
|
||||
|
||||
spapi = SPAPI(card_id='CARD_ID', token='TOKEN')
|
||||
|
||||
|
||||
async def main():
|
||||
me = await spapi.me
|
||||
print(me)
|
||||
|
||||
loop = get_event_loop()
|
||||
loop.run_until_complete(main())
|
||||
@@ -1,3 +0,0 @@
|
||||
import pyspapi
|
||||
|
||||
print(pyspapi.MojangAPI.get_name_history(uuid='63ed47877aa3470fbfc46c5356c3d797'))
|
||||
@@ -1,20 +0,0 @@
|
||||
import pyspapi
|
||||
|
||||
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797'))
|
||||
|
||||
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').timestamp)
|
||||
|
||||
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').id)
|
||||
|
||||
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').name)
|
||||
|
||||
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').is_legacy_profile)
|
||||
|
||||
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').cape_url)
|
||||
|
||||
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').skin_url)
|
||||
|
||||
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').skin_model)
|
||||
|
||||
print(pyspapi.MojangAPI.get_profile(uuid='63ed47877aa3470fbfc46c5356c3d797').skin)
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import pyspapi
|
||||
|
||||
print(pyspapi.MojangAPI.get_username(uuid='63ed47877aa3470fbfc46c5356c3d797'))
|
||||
@@ -1,5 +0,0 @@
|
||||
import pyspapi
|
||||
|
||||
print(pyspapi.MojangAPI.get_uuid(username='deesiigneer'))
|
||||
|
||||
print(pyspapi.MojangAPI.get_uuids(['deesiigneer', '5opka', 'OsterMiner']))
|
||||
21
examples/payments.py
Normal file
21
examples/payments.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from pyspapi import SPAPI
|
||||
from pyspapi.types import Item
|
||||
from asyncio import get_event_loop
|
||||
|
||||
spapi = SPAPI(card_id='CARD_ID', token='TOKEN')
|
||||
|
||||
items = [Item('first item', 1, 2, 'first item comment').to_json(),
|
||||
Item('second item', 3, 4, 'second item comment').to_json()]
|
||||
|
||||
|
||||
async def main():
|
||||
print(await spapi.create_payment(items=items,
|
||||
redirect_url='https://www.google.com/',
|
||||
webhook_url='https://www.google.com/',
|
||||
data='some-data'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
loop = get_event_loop()
|
||||
loop.run_until_complete(main())
|
||||
@@ -1,5 +0,0 @@
|
||||
import pyspapi
|
||||
|
||||
spapi = pyspapi.SPAPI(card_id='card_id', token='token')
|
||||
|
||||
print(spapi.check_users_access([262632724928397312, 264329096920563714]))
|
||||
@@ -1,11 +0,0 @@
|
||||
import pyspapi
|
||||
|
||||
spapi = pyspapi.SPAPI(card_id='card_id', token='token')
|
||||
|
||||
print(spapi.get_user(262632724928397312))
|
||||
|
||||
print(spapi.get_user(262632724928397312).username)
|
||||
|
||||
print(spapi.get_user(262632724928397312).access)
|
||||
|
||||
print(spapi.get_users([262632724928397312, 264329096920563714]))
|
||||
@@ -1,10 +0,0 @@
|
||||
import pyspapi
|
||||
|
||||
spapi = pyspapi.SPAPI(card_id='card_id', token='token')
|
||||
|
||||
print(spapi.payment(amount=1,
|
||||
redirect_url='https://www.google.com/',
|
||||
webhook_url='https://www.google.com/',
|
||||
data='some-data'
|
||||
)
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
import pyspapi
|
||||
|
||||
spapi = pyspapi.SPAPI(card_id='CARD_ID', token='TOKEN')
|
||||
|
||||
print(spapi.transaction(receiver=12345,
|
||||
amount=1,
|
||||
comment="test"
|
||||
)
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
import pyspapi
|
||||
|
||||
spapi = pyspapi.SPAPI(card_id='your_card_id', token='your_token')
|
||||
|
||||
print(spapi.webhook_verify(data='webhook_data', header='webhook_header'))
|
||||
16
examples/transaction.py
Normal file
16
examples/transaction.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from pyspapi import SPAPI
|
||||
from asyncio import get_event_loop
|
||||
|
||||
spapi = SPAPI(card_id='CARD_ID', token='TOKEN')
|
||||
|
||||
|
||||
async def main():
|
||||
new_balance = await spapi.create_transaction(receiver='77552',
|
||||
amount=1,
|
||||
comment="test"
|
||||
)
|
||||
print(new_balance)
|
||||
|
||||
|
||||
loop = get_event_loop()
|
||||
loop.run_until_complete(main())
|
||||
13
examples/webhook.py
Normal file
13
examples/webhook.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from pyspapi import SPAPI
|
||||
from asyncio import get_event_loop
|
||||
|
||||
spapi = SPAPI(card_id='CARD_ID', token='TOKEN')
|
||||
|
||||
# print(spapi.webhook_verify(data='webhook_data', header='webhook_header'))
|
||||
|
||||
|
||||
async def main():
|
||||
print(await spapi.update_webhook(url='https://example.com/webhook'))
|
||||
|
||||
loop = get_event_loop()
|
||||
loop.run_until_complete(main())
|
||||
Reference in New Issue
Block a user