Skip to main content

Parrot is a simple HTTP server that responds to requests with a specified filename

Project description

parrot is a simple HTTP server that responds to any valid GET request with the file specified on the command line.

It is useful during testing (e.g. to mock out a server application), or to do client testing. Both text and binary files are handlded correctly.

Its only dependency is the excellent python-magic library for mime type guessing. It works on Python 3.

$ pip install python-parrot

Usage

$ parrot port filename

The following arguments are required:

  • port: Port to listen on

  • filename: Filename of the data to send in response to all requests

Sample

Start the parrot server:

$ echo 'This is a test' > test.txt
$ parrot 8000 test.txt
parrot/1.0.0 listening on 0.0.0.0:8000 with file test.txt (text/plain)

In another terminal (assuming 10.1.1.1 is a valid IP on the server):

$ echo 'GET /anything HTTP/1.0' | nc 10.1.1.1 8000
HTTP/1.0 200 OK
Server: parrot/1.0.0 Python/3.4.2
Date: Thu, 24 Sep 2015 00:27:56 GMT
Content-Type: text/plain

This is a test

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

python-parrot-1.0.1.tar.gz (2.7 kB view details)

Uploaded Source

File details

Details for the file python-parrot-1.0.1.tar.gz.

File metadata

  • Download URL: python-parrot-1.0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python-parrot-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6e32f4bf763685e6cbae7063e6095435420855d4d5f4a38cd8a85aedcb7aefab
MD5 59a7846c6df1b1663f4aa200ba7f326e
BLAKE2b-256 fa610780aa1a0383ac42e0cc4c8f7e6d2157d255717c4562624aac758af9cb71

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