A python type API module for FNBR.co.
Asyncronous and non-asyncronous
You will need a twitter account to request an api key. To get yours send a request to the great guys over at fnbr.co in their api channel.
Simply send a message along the lines of: Hey I would like to request an api key for [YOUR REASON] my twitter is @[YOUR TWITTER HANDLE].
Installing is simple using PyPi.
pip install -U fnbr-api
You can then import using
import fnbr # blocking
or
import aiofnbr # asyncronous non-blocking
All for python 3.5
import fnbr
apikey = 'YOUR_API_KEY'
request = fnbr.Shop(apikey)
response = request.send()
if response.status == 200 and response.type == fnbr.constants.SHOP_TYPE:
shop = response.data
print('Shop for: {0}'.format(shop.date))
print('Daily items:')
for item in shop.daily:
print('\t{0}: {1}'.format(item.name,item.price))
print('Featured items:')
for item in shop.featured:
print('\t{0}: {1}'.format(item.name,item.price))
else:
print('Error getting shop')
import fnbr
apikey = 'YOUR_API_KEY'
itemname = 'Rex' # the search is case sensitive
itemtype = 'outfit' # must be one of 'emote','glider','emoji','loading','outfit','pickaxe','skydive','umbrella' or 'misc'. not case sensitive
itemlimit = 1 # integer between 1 and 15
request = fnbr.Images(apikey,search=itemname,type=itemtype,limit=itemlimit)
response = request.send()
if response.status == 200 and response.type == fnbr.constants.IMAGE_TYPE:
print('Results:')
imagedata = response.data
for item in imagedata.results:
print('{0}: {1}'.format(item.name,item.price))
else:
print('Error searching images')
import fnbr
apikey = 'YOUR_API_KEY'
request = fnbr.Stat(apikey)
response = request.send()
if response.status == 200 and response.type == fnbr.constants.STATS_TYPE:
statdata = response.data
print('Total cosmetics: {0}'.format(statdata.totalCosmetics))
else:
print('Error getting stats')
import aiofnbr
import asyncio
loop = asyncio.get_event_loop()
apikey = 'YOUR_API_KEY'
request = fnbr.Shop(apikey)
response = loop.run_until_complete(request.send())
if response.status == 200 and response.type == fnbr.constants.SHOP_TYPE:
shop = response.data
print('Shop for: {0}'.format(shop.date))
print('Daily items:')
for item in shop.daily:
print('\t{0}: {1}'.format(item.name,item.price))
print('Featured items:')
for item in shop.featured:
print('\t{0}: {1}'.format(item.name,item.price))
else:
print('Error getting shop')
import aiofnbr
import asyncio
loop = asyncio.get_event_loop()
apikey = 'YOUR_API_KEY'
itemname = 'Rex' # the search is case sensitive
itemtype = 'outfit' # must be one of 'emote','glider','emoji','loading','outfit','pickaxe','skydive','umbrella' or 'misc'. not case sensitive
itemlimit = 1 # integer between 1 and 15
request = fnbr.Images(apikey,search=itemname,type=itemtype,limit=itemlimit)
response = loop.run_until_complete(request.send())
if response.status == 200 and response.type == fnbr.constants.IMAGE_TYPE:
print('Results:')
imagedata = response.data
for item in imagedata.results:
print('{0}: {1}'.format(item.name,item.price))
else:
print('Error searching images')
import aiofnbr
import asyncio
loop = asyncio.get_event_loop()
apikey = 'YOUR_API_KEY'
request = fnbr.Stat(apikey)
response = loop.run_until_complete(request.send())
if response.status == 200 and response.type == fnbr.constants.STATS_TYPE:
statdata = response.data
print('Total cosmetics: {0}'.format(statdata.totalCosmetics))
else:
print('Error getting stats')