Enzyme Self Calculation API Example

API Description

This API allows you to perform enzyme self-calculation based on EC number. Authentication is required for POST requests.

Usage

Send a POST request to the API endpoint with EC number and email address. Basic authentication is required for POST requests.

Example Code


import requests
from requests.auth import HTTPBasicAuth

def enzyme_self_calc(ec_number, email, api_url, username, password):
    auth = HTTPBasicAuth(username, password)
    data = {
        'ec-number': ec_number,
        'email': email
    }
    
    response = requests.post(api_url, json=data, auth=auth)
    
    if response.status_code == 200:
        result = response.json()
        return result
    else:
        print(f"Error: {response.status_code}")
        print(response.text)
        return None

# Usage example
if __name__ == "__main__":
    ec_number = "1.1.1.1"
    email = "your_email@example.com"
    api_url = 'https://www.mtc-lab.cn/enzyme_register/api/enzyme_self_calc/'
    username = 'your_username'
    password = 'your_password'

    result = enzyme_self_calc(ec_number, email, api_url, username, password)
    if result:
        if result['success']:
            print(f"Calculation successful. Result URL: https://www.mtc-lab.cn/{result['url']}")
        else:
            print(f"Calculation failed. Error: {result['error']}")
    else:
        print("API request failed.")
Note: This API is developed by the MTC-Lab team. Please use it responsibly and ensure you have the necessary credentials to access the API.

Instructions

  1. Replace '1.1.1.1' with the actual EC number you want to calculate.
  2. Replace 'your_email@example.com' with your actual email address.
  3. Replace 'your_username' and 'your_password' with your actual API credentials.
  4. Run the script to perform the enzyme self-calculation.
  5. The API will send an email with the result URL upon successful completion.