Skip to main content

Send trial products take easy.

Project description

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 💖

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MHPKMS-1.0.0.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

MHPKMS-1.0.0.2-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file MHPKMS-1.0.0.2.tar.gz.

File metadata

  • Download URL: MHPKMS-1.0.0.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for MHPKMS-1.0.0.2.tar.gz
Algorithm Hash digest
SHA256 efd2402cc58a7abc5ed1410a4fed48a08f0767cf9b6b5940107b421bcc4e9405
MD5 c9e258614f1080f71de91774d03d760b
BLAKE2b-256 9e134c36ab8c4f143c9bfec6fac4a57752a7a8f7d80391f9659ed9ce4f13adb3

See more details on using hashes here.

File details

Details for the file MHPKMS-1.0.0.2-py3-none-any.whl.

File metadata

  • Download URL: MHPKMS-1.0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for MHPKMS-1.0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1acd743e7c6eb1fb29541978908e1cc48c0474ec12bc50a0ad4e0caf09e42d31
MD5 bc2d65d960bea15cad2586dd4a42ce6c
BLAKE2b-256 7a08aee99760e517d29ae7e292a5bc19f8f3ffc90083506d9b8db20f769b394f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page