Python wrapper of the fnbr.co fortnite shop API for ease of use in a python enviroment.


Keywords
API, fortnite, fnbr, api-client, apis, forniteapi, fortnite-api, fortnite-shop, fortnitebr
License
MIT
Install
pip install fnbr-api==1.1.4

Documentation

FNBR API

A python type API module for FNBR.co.

Asyncronous and non-asyncronous

Documentation

Api keys

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

Installing is simple using PyPi.

pip install -U fnbr-api

You can then import using

import fnbr # blocking

or

import aiofnbr # asyncronous non-blocking

Examples

fnbr (Blocking)

All for python 3.5

Retreive today's shop

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')

Search for an image

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')

Get statistics

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')

aiofnbr (non-blocking)

Retreive today's shop

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')

Search for an image

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')

Get statistics

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')

Links