semvec/pypi-packages huggingface dataset:
pylumberjack 0.0.1
Python Logging for Humans
License: MIT

# Lumberjack - Python Logging for Humans™

## What is this?

This project is about creating a custom logger with a few arguments such as logger name and file path (if FileHandler is used).

## Why was this made?

In the python projects I have worked with (work or personal projects), I have always had to create a logging instance with a FileHandler, provide a logging format, provide logging file name (and create directories if need be), which is extremely frustrating, at the least. So I decided to encapsulate the pain points regarding the aforementioned.

## How do I use this?

```
from lumberjack import Lumberjack

# outputs logs in the console.
logger = Lumberjack(name="lumberjack")

# outputs logs in the filename 'logs/lumberjack_<timestamp>.log'
logger = Lumberjack(name="lumberjack", file_name="logs/lumberjack.log")

logger.info('Live long and prosper, hoomans')

# Log output
2017-02-23 20:31:41,932 - lumberjack - INFO - Live long and prosper, hoomans!
```

## Can I contribute to this?

Sure! Create an issue in the repo if it's not already present. Then fork this repo, branch off from `master`, add a feature / push a fix and raise a pull-request. I'll merge it once I deem it useful.
scrapydo 0.2.2
Crochet-based blocking API for Scrapy.
License: MIT

ScrapyDo
========

Crochet_-based blocking API for Scrapy_.

This module provides function helpers to run Scrapy_ in a blocking fashion. See
the `scrapydo-overview.ipynb <http://nbviewer.ipython.org/github/darkrho/scrapydo/blob/master/notebooks/scrapydo-overview.ipynb>`_
notebook for a quick overview of this module.


Installation
============

Using ``pip``::

  pip install scrapydo


Usage
=====

The function ``scrapydo.setup`` must be called once to initialize the reactor.

Example:

.. code:: python

    import scrapydo
    scrapydo.setup()

    scrapydo.default_settings.update({
        'LOG_LEVEL': 'DEBUG',
        'CLOSESPIDER_PAGECOUNT': 10,
    })

    # Enable logging display
    import logging
    logging.basicConfig(level=logging.DEBUG)

    # Fetch a single URL.
    response = scrapydo.fetch("http://example.com")

    # Crawl an URL with given callback.
    def parse_page(response):
        yield {
            'title': response.css('title').extract(),
            'url': response.url,
        }
        for href in response.css('a::attr(href)'):
            url = response.urljoin(href)
            yield Request(url, callback=parse_page)

    items = scrapydo.crawl('http://example.com', callback)

    # Run an existing spider class.
    spider_args = {'foo': 'bar'}
    items = scrapydo.run_spider(MySpider, **spider_args)


Available Functions
===================

``scrapydo.setup()``
    Initialize reactor.

``scrapydo.fetch(url, spider_cls=DefaultSpider, capture_items=True, return_crawler=False, settings=None, timeout=DEFAULT_TIMEOUT)``
    Fetches an URL and returns the response.

``scrapydo.crawl(url, callback, spider_cls=DefaultSpider, capture_items=True, return_crawler=False, settings=None, timeout=DEFAULT_TIMEOUT)``
    Crawls an URL with given callback and returns the scraped items.

``scrapydo.run_spider(spider_cls, capture_items=True, return_crawler=False, settings=None, timeout=DEFAULT_TIMEOUT, **kwargs)``
    Runs a spider and returns the scraped items.

``highlight(code, lexer='html', formatter='html', output_wrapper=None)``
    Highlights given code using pygments. This function is suitable for use in a IPython notebook.


.. _Scrapy: http://scrapy.org
.. _Crochet: https://github.com/itamarst/crochet