Skip to main content

Hướng dẫn sử dụng bản MHPKMS Online


Working with framework

Phần hướng dẫn này sẽ giúp các bạn sử dụng MHPKMS với Flask, nhưng bạn cũng có thể áp dụng MHPKMS vào các framework khác.

from flask import (Flask, request, abort, make_response) # Load thư viện flask
from MHPKMS_client import Client # Load Client của MHPKMS

app = Flask(__name__)
client = Client()
# client.set_client(<client-key>)
# client.set_appid(<appid>)

@app.get("/api/secrets")
def secrets():
    # Sử dụng MHPKMS để kiểm tra key
    key = request.args.get('key')
    check = client.activate(key) # Kiểm tra key
    if not check: # Sai key
        abort(401)
    return make_response("Hi, I'm secret.", 200) # Trả về thông tin được bảo vệ

Selenium with framework, and MHPKMS

Bạn thậm chí có thể chạy Selenium (Automation) trên framework! Trong bài viết này, chúng ta sẽ chạy Selenium trên Flask cùng với bảo mật của MHPKMS

import ... # Thêm các thư viện cần thiết cho Selenium, Flask
from MHPKMS_client import Client

app = Flask(__name__)
client = Client()
# client.set_client(<client-key>)
# client.set_appid(<appid>)

@app.get("/api/tool/dojob")
def dojob():
    # Kiểm tra key trước, giảm resource cần dùng cho server
    key = request.args.get('key')
    check = client.activate(key)
    if not check:
        abort(401)
    driver = ... # Loại driver bạn muốn dùng
    ... # Do job
    return make_response(<kết-quả>, 200) # Return sau khi do job xong
curl <host>/api/tool/dojob -> 401
curl <host>/api/tool/dojob?key=<legit-key> -> 200

Với mợt vài lệnh cơ bản, bạn đã có thể làm tool mà không lo bị sử dụng trái phép, MHPKMS sẽ bảo vệ bạn khỏi abuse nên bạn không phải lo lắng 💖

Release files for MHPKMS 1.0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for MHPKMS 1.0.0.2
File Size Uploaded
MHPKMS-1.0.0.2.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for MHPKMS 1.0.0.2
File Interpreter ABI Platform
MHPKMS-1.0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.1 kB

Release files / MHPKMS-1.0.0.2.tar.gz

Download URL MHPKMS-1.0.0.2.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
efd2402cc58a7abc5ed1410a4fed48a08f0767cf9b6b5940107b421bcc4e9405
BLAKE2b-256 checksum
How to use checksums
9e134c36ab8c4f143c9bfec6fac4a57752a7a8f7d80391f9659ed9ce4f13adb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Release files / MHPKMS-1.0.0.2-py3-none-any.whl

Download URL MHPKMS-1.0.0.2-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1acd743e7c6eb1fb29541978908e1cc48c0474ec12bc50a0ad4e0caf09e42d31
BLAKE2b-256 checksum
How to use checksums
7a08aee99760e517d29ae7e292a5bc19f8f3ffc90083506d9b8db20f769b394f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

1.0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page