Skip to main content

API package for testing purpose

Project description


This package is used for REST API classbased, author used it for API flow testing.
JSON body response will be converted to python data type. Made it easier for you to use.

This package is extending python requests library

How to install

$ pip3 install api-nichotined

How to distribute to pypi

$ python sdist bdist_wheel && python -m twine upload dist/*

Usage example

from API import Get, Post

from import_file import host

post_body = {
    "name": "Nicholas Frederick"

class GetRequest(Get):
    def __init__(self, latitude: str, longitude: str):
        self.url = "{0}/dummy?latitude={1}&longitude={2}".format(host["serviceHost"], latitude, longitude)
        self.headers = {
            "Content-Type": "application/json",
            "Authorization": "TOKEN"

class PostRequest(Post):
    def __init__(self, body: Data):
        self.url = "{0}/dummy".format(host['serviceHost'])
        self.headers = {
            "Content-Type": "application/json",
            "Authorization": "TOKEN"
        self.json = body

if __name__ == "__main__":
    get_data = GetRequest('106', '80')
    post_data = PostRequest(post_body)
    assert get_data.address_name == "somewhere"
    assert post_data.status_code == 200

Mocker usage
Beforehand, edit or extend and add your desired response on that file.

$ mitmproxy -p 8888 -s API/modules/mocker/

Project details

Download files

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

Files for api-nichotined, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size api_nichotined-1.1.1-py3-none-any.whl (11.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size api-nichotined-1.1.1.tar.gz (6.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page