Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hunk

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hunk

Mock for JSON API server.

  • 0.1.0
  • PyPI
  • Socket score

Maintainers
1

hunk

Helps client-side Web development by mocking JSON API server.

Installation

hunk can be installed via pip or easy_install:

.. code-block:: bash

$ pip install hunk

Or:

.. code-block:: bash

$ easy_install hunk

Usage

Setup data directory and files.

  • Directories under the root have a HTTP method name
  • Directories and files have name to be resource path
  • Files have conent to be response JSON

For example:

.. code-block:: bash

$ tree demo/simple/
demo/simple/
|-- get
|   |-- members
|   |   |-- 100.json
|   |   |-- 200.json
|   |   |-- 300.json
|   |   ...
|   +-- sounds.json
|-- post
|   +-- members.json
...

Move to the root directory and run hunk:

.. code-block:: bash

$ cd demo/simple/
$ hunk
 * Running on http://localhost:8080/

Now, you can access Web API with HTTP:

.. code-block:: bash

$  curl http://localhost:8080/members/100
{"gender": "female", "kind": "human", "name": "Dorothy"}

$ curl http://localhost:8080/members
[{"kind": "scarecrow", "name": "Hunk"}, ...]

$ curl http://localhost:8080/sounds
[{"title": "Over The Rainbow"}, ... ]

$ curl http://localhost:8080/members -X POST
{"result": "success"}

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc