Giter Club home page Giter Club logo

rangehttpserver's Introduction

Build Status Coverage Status

RangeHTTPServer

SimpleHTTPServer with support for Range requests

Quickstart:

$ pip install rangehttpserver
$ python -m RangeHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

Alternatives

If you've found this, you may also be intersted in node's http-server, which also includes support for Range requests.

Development

To release a new version:

pip install --upgrade wheel setuptools twine
python setup.py sdist bdist_wheel
twine upload dist/*

rangehttpserver's People

Contributors

berdario avatar danvk avatar garfieldjiang avatar kloczek avatar thedorkknight avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rangehttpserver's Issues

Tag the source

Could you please tag the source again? This allows distributions to get the complete source from GitHub if they want.

Thanks

1.3.3; pytest fail in all tests/server_test.py units

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

python 3.9 and pytest 8.1.0

Please let me know if you need more details or want me to perform some diagnostics.

Transfer ownership

I created RangeHTTPServer in Feb 2015 to fill a specific need I had in one of my projects. I discovered later that month that there was a better way for me to address that need (see c5d19c8) and I have never personally used this tool since then.

Nevertheless, it does seem that there is an ongoing need for this. There's an existing request to add Range support to Python's built-in http.server here: python/cpython#86809. That would be the idea solution.

Barring that, the next best option would be to transfer ownership of this repo to someone who actively uses it.

License is missing copyright year and copyright owner

Near the end of the LICENSE file, the copyright year and author have been left as the template:

Copyright {yyyy} {name of copyright owner}

This makes it difficult to use this software legally, so please consider filling those in.

Warnings when installing via pip

I'm getting WARNING: '.' not a valid package name when installing via pip install RangeHTTPServer. Maybe I need to move RangeHTTPServer.py into a rangehttpserver package.

pip install RangeHTTPServer
Downloading/unpacking RangeHTTPServer
  Downloading rangehttpserver-1.1.1.tar.gz
  Running setup.py (path:/private/var/folders/9q/340_463n2fvbzjg232s3hrt00000gn/T/pip_build_danvk/RangeHTTPServer/setup.py) egg_info for package RangeHTTPServer
    WARNING: '.' not a valid package name; please use only.-separated package names in setup.py

    package init file '__init__.py' not found (or not a regular file)
Installing collected packages: RangeHTTPServer
  Running setup.py install for RangeHTTPServer
    WARNING: '.' not a valid package name; please use only.-separated package names in setup.py
    package init file '__init__.py' not found (or not a regular file)

Successfully installed RangeHTTPServer
Cleaning up...

Running with Python 2.7.13 produces error?

Running with python -m RangeHTTPServer

$ python -m RangeHTTPServer
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/site-packages/RangeHTTPServer/__main__.py", line 24, in <module>
    SimpleHTTPServer.test(HandlerClass=RangeRequestHandler)
AttributeError: 'module' object has no attribute 'test'

Tried reinstalling just in case but seems to still have the error

pip install --upgrade --force-reinstall RangeHTTPServer
Collecting RangeHTTPServer
  Using cached rangehttpserver-1.2.0-py2.py3-none-any.whl
Installing collected packages: RangeHTTPServer
  Found existing installation: rangehttpserver 1.2.0
    Uninstalling rangehttpserver-1.2.0:
      Successfully uninstalled rangehttpserver-1.2.0
Successfully installed RangeHTTPServer-1.2.0

Python3 does work though (installed via pip3 install RangeHTTPServer)

Trying to see how to include this in place of http.server

At the end of a larger python3 script I start an http.server but it's not meeting my needs because it doesn't support Range requests. This appears to extend SimpleHttpServer and I'm struggling to see if I can incorporate it into my usage. Currently I have these imports at the top of my script:

from http.server import BaseHTTPRequestHandler, HTTPServer
from http.server import CGIHTTPRequestHandler

And then can call my run() method to start the server when I need it:

def run(host=None, port=None, script_args=None):
    args = {'annotation_dir': script_args.input_directory, 'fasta_file': script_args.fasta_file}
    args_string = urllib.parse.urlencode(args)

    initial_url = "http://{0}:{1}/index.html?{2}".format(host, port, args_string)
    print("Starting GALESui server.  Open your browser to the following URL:\n\n{0}".format(initial_url), flush=True)
 
    # Server settings
    server_address = (host, port)
    handler = CGIHTTPRequestHandler
    handler.cgi_directories = ["/cgi"]
    httpd = HTTPServer(server_address, CGIHTTPRequestHandler)
    httpd.serve_forever()

Where does your ranged module fit here, or is this outside its scope? Thanks for the help.

server_test.py failed

================================================================ test session starts =================================================================
platform linux -- Python 3.7.2, pytest-3.6.4, py-1.5.4, pluggy-0.6.0
rootdir: /home/lbazan/rpmbuild/BUILD/RangeHTTPServer-1.2.0, inifile:
plugins: cov-2.5.1
collected 11 items

tests/RangeHTTPServer_test.py .. [ 18%]
tests/server_test.py

Port option does not work

Looks like the port is ignored:

$ python --version
Python 3.7.0
$ python -m RangeHTTPServer 80
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...

Installed using $ pip install --user rangehttpserver

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.