Skip to main content

🤖 A CI tool for monitoring a specific API end points and keeping fake API server always up-to-date.

Project description

PyFake-API-Server-Surveillance

PyPI Release CI codecov pre-commit.ci status Quality Gate Status License: MIT

🤖 A CI tool for monitoring a specific API end points and keeping fake API server always up-to-date.

Overview | Python versions support | Quickly Start | Documentation


Overview

Do you ever have experience about Back-End side does something change on the sly, but they don't sync the change with Font-End side and cause it be broken? Even you may have tool which could fake an API server, but you still need to update it manually (if you know the change). This tool Fake-API-Server-Surveillance targets to resolve this issue by everyone could automate the process about monitoring and updating the fake server which be built by Fake-API-Server.

Python versions support

The code base of PyFake-API-Server-Surveillance depends on another library Fake-API-Server. So it also only supports Python 3.8 version up.

Supported Versions

Quickly Start

Here section would lead you quickly start to set up your first automation with PyFake-API-Server-Surveillance for keep monitoring Back-End side and keep the fake server always be the latest version under surveillance easily.

In basically, it has 3 steps: prepare your fake server, configure PyFake-API-Server-Surveillance and set action for GitHub Action.

Prepare Fake-API-Server

First of all, this tool only for Fake-API-Server. So you must have a GitHub project which records the details configuration of Fake-API-Server.

Configure Fake-API-Server-Surveillance

The detail settings of Fake-API-Server-Surveillance would be configured by YAML file. Here provide a sample configuration:

api-doc-url: 'http://127.0.0.1:1111/swagger-api'
fake-api-server:
  server-type: rest-server
  subcmd:
    pull:
      args:
        - --config-path=./api.yaml
        - --include-template-config
        - --base-file-path=./
        - --base-url=/test/v1
        - --divide-api
git-info:
  repo: 'TestUser/Back-End-Project'
  commit:
    author:
      name: 'TestUser'
      email: 'test@gmail.com'
    message: ' 🧪 test commit message.'
github-info:
  pull-request:
    title: '🤖 Update API configuration'
    body: '🚧 test content ...'
    draft: true
    labels:
      - '🤖 update by bot'

Configure GitHub Action CI setting

Add a single CI workflow which only for monitoring Back-End side change as a scheduler:

name: Monitor Back-End API interface

on:
  # In generally, it's reasonable that using schedule feature of GitHub Action to monitor the Back-End side API change..
  schedule:
    - cron: "15 4,5 * * *"   # <=== Change this value

permissions:
  contents: write  # Need this to push commits
  pull-requests: write  # Need this to open pull request

jobs:
  monitor-and-update:
    runs-on: ubuntu-latest
    steps:
      # Clone the fake-api-server config
      - name: Clone project
        uses: actions/checkout@v4

      # Monitor and update the config if it needs by opening pull request
      - name: Run Fake-API-Server-Surveillance
        uses: actions/PyFake-API-Server-Surveillance@v0.2.0
        with:
          config-path: <your fake-api-server-surveillance config>
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Congratulation! Now, you could just have a coffee and do anything you want to do without being worry about the fake server be expired. The CI workflow would be the trustworthy partner to help you keep monitoring and updating the fake server if it needs without missing any change.

Documentation

documentation

The documentation contains more details, demonstrations and anything you need about PyFake-API-Server-Surveillance.

Coding style and following rules

PyFake-API-Server-Surveillance follows coding styles black and PyLint to control code quality.

Code style: black linting: pylint

Downloading state

PyFake-API-Server-Surveillance still a young open source which keep growing. Here's its download state:

Downloads Downloads

License

MIT License

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

fake_api_server_surveillance-0.2.0.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

fake_api_server_surveillance-0.2.0-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

Details for the file fake_api_server_surveillance-0.2.0.tar.gz.

File metadata

  • Download URL: fake_api_server_surveillance-0.2.0.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1013-azure

File hashes

Hashes for fake_api_server_surveillance-0.2.0.tar.gz
Algorithm Hash digest
SHA256 71f269339b209e56f287aca53161c010910b3b2a1f54b47fbd46e867e2e62f03
MD5 e00c9f2d6443e03c863a9149776bb7c5
BLAKE2b-256 73798eb42dd85dff70cff093ba12b3e669aec07f3e8287e46e2c4a5f9adcbbd5

See more details on using hashes here.

File details

Details for the file fake_api_server_surveillance-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fake_api_server_surveillance-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4436677521d2b82e2a0e61445a892d27f1e9d64ef44f44fec22adab1fc7ec057
MD5 dd1dfd516460ef8f7f835557799d93f3
BLAKE2b-256 a32e8ab638da4e4535d0f73462ac31ed09e18f47aca0c4c5c6cac23a708e25f1

See more details on using hashes here.

Supported by

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