Skip to main content

Apprentice is a library for deploying and developing actions via Dialogflow and Google Cloud Functions.

Project description

Apprentice

Build Status PyPI version

Apprentice is a library for deploying and developing actions via Dialogflow and Google Cloud Functions.

Installation

Use the package manager pip to install Apprentice.

pip install apprentice

Usage

import random

import requests

from apprentice import format_response, generate_intent_response


def cool_fact_generator(*args, **kwargs):
    data = _fact_response()
    formatted_data = generate_intent_response(data)
    return format_response(formatted_data)


def _fact_response():
    res = requests.get('https://history.muffinlabs.com/date')
    data = res.json().get('data')

    fact = random.choice(data['Events'])
    year = fact['year']
    text = fact['text']
    phrase = f'Today, in the year {year} {text}'
    return phrase

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

GNU 3.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apprentice-0.1.5.tar.gz (20.0 kB view details)

Uploaded Source

File details

Details for the file apprentice-0.1.5.tar.gz.

File metadata

  • Download URL: apprentice-0.1.5.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for apprentice-0.1.5.tar.gz
Algorithm Hash digest
SHA256 7e96ee912c23016d7c7547ef7a918c040da76e7e62b5ac6a2b68dd3597d12268
MD5 68cd1bd3484c99bda26e51dcadb2cf0f
BLAKE2b-256 eaf89ec6ce93e6d9626adff4f0130f25275adda749262f0e1a8c8abf54b4e934

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page