Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sjkingo/python-parrot
parrot is a simple HTTP server that responds to any valid GET request with the file specified on the command line
https://github.com/sjkingo/python-parrot
http http-server python python-3
Last synced: about 17 hours ago
JSON representation
parrot is a simple HTTP server that responds to any valid GET request with the file specified on the command line
- Host: GitHub
- URL: https://github.com/sjkingo/python-parrot
- Owner: sjkingo
- License: bsd-2-clause
- Created: 2015-09-24T00:48:17.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-24T00:58:48.000Z (about 9 years ago)
- Last Synced: 2024-09-13T13:31:31.105Z (12 days ago)
- Topics: http, http-server, python, python-3
- Language: Python
- Size: 129 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-parrot
[parrot](https://youtu.be/npjOSLCR2hE) 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](https://github.com/ahupp/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/plainThis is a test
```