semvec/pypi-packages huggingface dataset:
unisquid 1.0.1
Yet another unittest extension for python.
License: MIT
Keywords: testing

********
unisquid
********

Yet another unittest extension for python.

Live Server Test Case 
---------------------

The LiveServerTestCase extension does basically the same as
unittest.TestCase but also launches a live http server in a 
separate thread.

A comma-separated list of ports or a range of ports can be specified
in the hope the live server can find one that is free to use for the
WSGI server. The range may be of the form: '8000-8010,8080,9020-9300'
and will be read from the 'LIVE_TEST_SERVER_ADDRESS' environment variable.

The function create_app() is used to return the handler used by the WSGI server.

Example
-------

.. code-block:: python

    import unisquid
    import urllib
    import wsgiref


    class TestLiveServer(unisquid.LiveServerTestCase):
        def create_app(self):
            return wsgiref.simple_server.demo_app

        def test_server_process_listening(self):
            response = urllib.urlopen(self.live_server_url)
            self.assertTrue(b'Hello world!' in response.read())
            self.assertEqual(response.code, 200)
requests_viewer 0.0.8
requests_viewer!
License: MIT

## requests_viewer

The idea is that `requests_viewer` can tell us information about our requests-objects quickly.

It opens up an HTML page with information for the request.

```python
import requests
from requests_viewer.web import view_request
view_request(requests.get("https://xkcd.com/"))

# or

from requests_viewer import main
main("https://xkcd.com/") # considers different mime types
```

### Main features

- HTML page is being shown as how the crawler sees it
    * Can extract the domain and hot-link so that it looks almost indistuinguishable
- Contains other nice functions to show lxml tree nodes
- Can visually show diffs between 2 html pages / trees

```python
from requests_viewer.web import view_diff_tree, get_tree
url1 = "http://xkcd.com/"
url2 = "http://xkcd.com/1/"
tree1 = get_tree(url1)  # get tree from request object directly
tree2 = get_tree(url2)  # could instead use `make_tree` if you already have a req
view_diff_tree(tree1, tree2)
```

Results in:

<p align="center">
<img src="https://raw.githubusercontent.com/kootenpv/requests_viewer/master/resources/screenshot1.png" width="80%" />
</p>

### Installation

    pip install requests_viewer
    pip3 install requests_viewer

Note that in order to do the real fancy stuff, you should install:

    pip install requests_viewer[fancy]
    pip3 install requests_viewer[fancy]

this will install `lxml`, `bs4` and `tldextract`.

### Types it can show currently:

- text/html
- image/*
- application/json

### Usability

Some example `web.py` functions:

``` python
def slugify(value):
def view_request(r, domain=None):
def view_html(x):
def view_node(node, attach_head=False, question_contains=None):
def view_tree(node):
def view_diff_tree(tree1, tree2, url, diff_method):
def view_diff_html(html1, html2, url, diff_method):
def view_diff(html1, html2, tree1, tree2, url, diff_method):
def make_parent_line(node, attach_head=False, question_contains=None):
def extract_domain(url):
def make_tree(html, domain=None):
def get_tree(url, domain=None):
def get_local_tree(url, domain=None):
```

### Contribute

This package is very small at the moment. I very much encourage you to contribute:

- Most likely we will want to show headers on the top of the package (html)