Giter Site home page Giter Site logo

pengfeili0218 / obp-api-scripts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openbankproject/obp-api-scripts

0.0 1.0 0.0 1.25 MB

A collection of scripts dealing with the API

License: GNU Affero General Public License v3.0

Python 100.00%

obp-api-scripts's Introduction

A collection of scripts dealing with the API

All these are using DirectLogin

Setup

  • Create a virtual environment: virtualenv --python=python3 venv

  • Then activate it: source venv/bin/activate

  • Now install requests in the virtualenv: pip install -r requirements.txt

  • Copy settings.py.example to settings.py and edit to suit your needs.

  • For future runs, you need to activate the virtualenv again, but do not need to recreate it or install the requirements.

  • When you are done, deactivate the virtualenv

Example input

  • In directory example_input you will find CSV/JSON files which should explain the format the scripts expect the input data to be.

Import Data

Python scripts to import data into the API

  • ./import_banks.py <csv file>
  • ./import_branches.py <csv file> <bank id>
  • ./import_products.py <csv file> <bank id>
  • ./import_atms.py <csv file> <bank id>

You probably have to edit the importer classes (method get_data) to match your input data as this changes with every dataset.

Print Data

  • ./print_account_data.py <json file>

Generate statistics

This is a bit different as it does not use the API, but talks directly to the database used by the API. You need to configure the settings accordingly. Run it on the database server with ./generate_stats.py

the webdriver of firefox or chrome need to be installed for selenium.

Start services

Please make sure that OBP-API server and API-Tester server is running

Configure settings

Create and edit settings.py, this setting file is used mainly for oauth1.0 login(both users and admin):

#Consumer key + secret to authenticate the _app_ against the API
OAUTH_CONSUMER_KEY = '<key>'
OAUTH_CONSUMER_SECRET = '<secret>'
# API hostname, e.g. https://api.openbankproject.com
API_HOST = '<hostname>'

# API_VERSION Used in project
API_VERSION = '3.1.0'

# API Tester hostname, e.g. https://apitester.openbankproject.com
REDIRECT_URL = 'http://127.0.0.1:9090'

OAUTH_TOKEN_PATH = '/oauth/initiate'
OAUTH_AUTHORIZATION_PATH = '/oauth/authorize'
OAUTH_ACCESS_TOKEN_PATH = '/oauth/token'

# Admin username and password
ADMIN_USERNAME = '<username>'
ADMIN_PASSWORD = '<password>'

FILE_ROOT = '<path>'

run PostCounterparty.py

$ python run\PostCounterpartyScript.py

run PostCustomer.py

make sure your admin account have the roles below: CanCreateCustomer or CanCreateCustomerAtAnyBank CanCreateCustomer and CanCreateUserCustomerLink CanCreateCustomerAtAnyBank and CanCreateUserCustomerLinkAtAnyBank CanGetAnyUser

$ python run\PostCustomerScript.py

obp-api-scripts's People

Contributors

sebtesobe avatar pengfeili0218 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.