Method Python SDK

2.1.1 · active · verified Sat Apr 11

The `method-python` library is an official Python client for interacting with the Method API. It provides convenient access to the Method platform's financial services, allowing developers to integrate banking and payment functionalities into their applications. Currently at version 2.1.1, the library is actively maintained with regular updates, including both minor feature enhancements and major version releases.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the `Method` client. It's crucial to securely manage your API key, preferably using environment variables. After initialization, you can use the `method` object to access various API endpoints as defined by the Method API documentation.

import os
from method import Method

# Initialize the Method client with your API key from an environment variable
# It is highly recommended to use environment variables for sensitive data like API keys.
api_key = os.environ.get('METHOD_API_KEY', 'YOUR_API_KEY_HERE')

# Initialize Method client for production environment
# Replace 'YOUR_API_KEY_HERE' with a placeholder or ensure it's loaded from env
method = Method(env='production', api_key=api_key)

# Example: List entities (replace with actual API call based on Method API docs)
try:
    # This is a placeholder; consult Method API documentation for actual endpoints
    # For instance, if there's a way to list all entities:
    # entities = method.entities.list()
    # print(f"Found {len(entities)} entities.")
    # print(entities)
    print("Method client initialized successfully. Consult API docs for specific calls.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →