semvec/pypi-packages huggingface dataset:
alexa-skill 0.1.0
A flexible and easy-to-use package for building Alexa skill applications.

# alexa-skill

[alexa-skill](https://github.com/stanwood/) is flexible, easy to use and extend package for creating Alexa skill applications.

This package is based on [alexa documentation](https://developer.amazon.com/docs/custom-skills/request-and-response-json-reference.html).


## Installing

Install and update using pip:

```bash
pip install -U alexa-skill
```

## Examples

Define intent class

```python
from alexa_skill.intents import BaseIntents


class ExampleIntents(BaseIntents):
    @property
    def mapper(self):
        return {
            'EXAMPLE.hello': self.hello,
        }

    def hello(self):
        return self.response('Hello. Nice to meet you.'), True
```

Define intent class with slots

```python
from alexa_skill import dates
from alexa_skill.intents import BaseIntents


class DateIntents(BaseIntents):
    @property
    def mapper(self):
        return {
            'EXAMPLE.date_intent': self.date_intent,
        }

    def date_intent(self, slots):

        date, date_type = dates.AmazonDateParser.to_date(slots['dateslot']['value'])

        text = "Your date is <say-as interpret-as='date'>{}</say-as> and it is a {}".format(
            date.strftime('%Y%m%d'),
            date_type
        )

        return self.response(text), True

```

Define buildin intents

```python
from alexa_skill.intents import BuildInIntents


buildin_intents = BuildInIntents(
    help_message='Say "HI" to us',
    not_handled_message="Sorry, I don't understand you. Could you repeat?",
    stop_message='stop',
    cancel_message='cancel'
)
```

### [Falcon](examples/falcon_app/main.py)

Initiate intents in fulfiller webhook for Alexa

```python
import logging

import alexa_skill
import falcon


class Fulfiller(object):

    def on_post(self, req, resp):
        get_response = alexa_skill.Processor(
            req.media,
            buildin_intents,
            'Welcome to Alexa skill bot',
            'Good bye',
            ExampleIntents(),  # Insert created Intents as arguments
            DateIntents(),
        )
        json_response, handled = get_response()

        logging.info('Response was handled by system: {}'.format(handled))

        resp.media = json_response

app = falcon.API(media_type=falcon.MEDIA_JSON)
app.add_route('/v1/alexa/fulfiller', Fulfiller())
```

### [Flask](examples/flask_app/main.py)

```python
import logging

import alexa_skill
from flask import Flask, request, jsonify


app = Flask(__name__)


@app.route("/v1/alexa/fulfiller", methods=['POST'])
def fulfiller():
    get_response = alexa_skill.Processor(
        request.json,
        buildin_intents,
        'Welcome to Alexa skill bot',
        'Good bye',
        ExampleIntents(),
        DateIntents(),
    )
    json_response, handled = get_response()

    logging.info('Response was handled by system: {}'.format(handled))

    return jsonify(json_response)
```

## Documentation

Auto generate documentation

```bash

cd docs/

sphinx-apidoc -o ./source/_modules/ ../alexa_skill/

make html
```
spinlog 0.3.0
Spinner Logger for Python
Keywords: cli terminal log logger logging shell update animation progress

# spinlog.py

[![PyPI](https://img.shields.io/pypi/v/spinlog.svg)](https://pypi.org/project/spinlog/)
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/spinlog.svg)](https://pypi.python.org/pypi/spinlog)
[![Build Status](https://travis-ci.org/AdrieanKhisbe/spinlog.py.svg?branch=master)](https://travis-ci.org/AdrieanKhisbe/spinlog.py)
[![codecov](https://codecov.io/gh/AdrieanKhisbe/spinlog.py/branch/master/graph/badge.svg)](https://codecov.io/gh/AdrieanKhisbe/spinlog.py)

> Spinner Logger for Python

## Installation

Just `pip install spinlog` and you can use it.

## Usage

Spinlog is build on top of [halo](https://github.com/manrajgrover/halo) providing a different API
to interact with the spinner.

### Basic Usage
```python
from spinlog import Spinner
from time import sleep

print("About to launch Spinner")
with Spinner.get("I'm spinning around") as s:
    sleep(2)
    s.info("Here is an info message while spinning around")
    # you can use s.warn, s.error, or s.debug
    sleep(2)
print("Spinning Over")
```

### Advanced usage
Spinlog is build in such a manner that you can disable the spinning animation
and replace it with proper logging without having to change the codebase.

This is done by creating a spinner instance, potentialy configured with two logger,
the `concommitant_logger` to be run alongside the spinner (for logging to file for instance),
and the `alternative_logger` to replace spinner animation and logging.

A complete example can be found in [the examples folder](./examples/with_logger.py)
Here is an except:
```python
# imports and logger definitions
should_spin = "--no-spin" not in sys.argv
# Configure spinner
spinner = Spinner(spinner="triangle", is_spinning=should_spin,
                  alternative_logger=stream_logger, concommitant_logger=file_logger)
# Use spinner
with spinner("Operation in progress") as s:
    sleep(2)
    s.info("Checkpoint reached")
    sleep(2)
```

## Licence
MIT © [AdrieanKhisbe](https://github.com/AdrieanKhisbe)
consulservicefinder 0.0.4
Find service from Consul
Requires Python: >=3
Keywords: consul microservice

# Consul Service Finder
I got a problem when I try to simulate multiple service register on Consul server and the client can find one of the services to use the API.

I can use below URL to get all services but that is not what I want.
<pre><code>curl http://localhost:8500/v1/agent/services</code></pre>

# Ideas

### * Consul Query to search service by service name
### * Count the service be used
### * Return min count of services by same service name

# Example
<pre><code>
    csf = ConsulServiceFinder()

    # create query by service name
    csf.createQueryByServiceName("microweb_microtalk", "q_test")

    # find one service and compose it's url
    csf.composeServiceUrl(csf.requestOneServiceByServiceName("microweb_microtalk"))

</code></pre>