Skip to content

nationalbankofgreece/nbg-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NBG API Python Library

Python library for the NBG API with a Django front-end, to perform API calls through the browser.

More information on the NBG API can be found at https://nbgdemo.portal.azure-api.net.

Configuration

To configure the NBG API Python client create a file with .env as its name in the root directory of your project. Add your subscription primary and secondary keys in the following format in this file:

NBG_PRIMARY_KEY=your_primary_key_here
NBG_SECONDARY_KEY=your_secondary_key_here

Usage

First of all, in order to use nbg open a Python terminal and import it like this:

import nbg

Below you can find several examples on how to use the NBG API with the nbg library.

Creating a resource

data = {
    'vehicleType': 'train',
    'maxSpeed': 125,
    'avgSpeed': 90,
    'speedUnit': 'mph'
}
response = nbg.create_resource(data)

Modifying a resource

data = {
    'id': 1
}
response = nbg.modify_resource(data)

Removing a resource

data = {
    'id': 1
}
response = nbg.remove_resource(data)

Retrieve resource headers

data = {
    'id': 1
}
response = nbg.retrieve_resource_headers(data)

Retrieve a resource

data = {
    'param1': 'sample',
    'param2': '{number}'
}
response = nbg.retrieve_resource(data)

Retrieve a cached resource

data = {
    'param1': 'sample',
    'param2': '{number}'
}
response = nbg.retrieve_resource_cached(data)

License

This boilerplate is licensed under the MIT License.

About

Python library for the NBG API with a Django front-end

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published