Skip to main content

An API client for simplifying API testing with Python + PyTest

Project description

🔥 berAPI 🔥

An API client for simplifying API testing with Python + PyTest

Features

  • Builtin curl API in the pytest-html report
  • Easy to import the API logs into Postman/curl
  • Multiple common assertions to a single request

Report

Installation

pip3 install berapi

How to use

from berapi.apy import berAPI

def test_simple():
    url = 'https://swapi.dev/api/people/1'
    api = berAPI()
    response = api.get(url).assert_2xx().parse_json()
    assert response['name'] == 'Luke Skywalker'

def test_chaining():
    (berAPI()
     .get('https://swapi.dev/api/people/1')
     .assert_2xx()
     .assert_value('name', 'Luke Skywalker')
     .assert_response_time_less_than(seconds=1)
     )

make sure pytest.ini is having output log

[pytest]
log_cli_level = INFO

Install Development

pip install poetry
pip install pytest
pip install pytest-html

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

berapi-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

berapi-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file berapi-0.1.1.tar.gz.

File metadata

  • Download URL: berapi-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for berapi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c111e2c711c340346b78566429f1bbec2e8715f0619675ec521c38524eb29b4c
MD5 3e88f92838d4a4aa7463921e11297172
BLAKE2b-256 057f530714db21c14f73469c6faaf5240938cc5a4b88af06c8177ea6b0685030

See more details on using hashes here.

File details

Details for the file berapi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: berapi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for berapi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1bcde014eac8f437c57509ca00843c51d5fd9e3b03403ed6a2f2297d61f4e955
MD5 c8b68e922dacd8c634d4d9ea2b2cc373
BLAKE2b-256 b73168c70d1109a74de8fa46cbf6deff27aa3cd97a865ec7c5b61d2c9d543e6a

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