Giter Site home page Giter Site logo

pyfttt's Introduction

pyfttt

Python tools for interacting with IFTTT Webhooks Channel.

Installation

pip install pyfttt

Command Line Tool

pyfttt is an included command line tool for sending Webhooks Channel events. To see a list of available arguments, run pyfttt --help, which produces:

usage: pyfttt [-h] [--version] [-k K] -e E [value1] [value2] [value3]

Send Webhooks Channel events to IFTTT

optional arguments:
  -h, --help       show this help message and exit
  --version        show program's version number and exit

sending events:
  -k K, --key K    IFTTT secret key
  -e E, --event E  The name of the event to trigger
  value1           Extra data sent with the event (optional)
  value2           Extra data sent with the event (optional)
  value3           Extra data sent with the event (optional)

Visit https://ifttt.com/channels/maker_webhooks for more information

The --key argument can be omittrd if the IFTTT secret key is defined in the environment as IFTTT_API_KEY.

Requirements

License

pyfttt is released under the BSD 2-clause license. See LICENSE for details.

pyfttt's People

Contributors

briandconnelly 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pyfttt's Issues

Install fails if requests package not already installed

Installing pyfttt while not having requests already pre-installed does not work.

› pip3 install pyfttt
Downloading/unpacking pyfttt
  Downloading pyfttt-0.1.tar.gz
  Running setup.py (path:/Users/paulus/dev/temp/pyvenv-test/build/pyfttt/setup.py) egg_info for package pyfttt
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/Users/paulus/dev/temp/pyvenv-test/build/pyfttt/setup.py", line 9, in <module>
        import pyfttt
      File "/Users/paulus/dev/temp/pyvenv-test/build/pyfttt/pyfttt/__init__.py", line 7, in <module>
        from pyfttt.sending import *
      File "/Users/paulus/dev/temp/pyvenv-test/build/pyfttt/pyfttt/sending.py", line 3, in <module>
        import requests
    ImportError: No module named 'requests'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/Users/paulus/dev/temp/pyvenv-test/build/pyfttt/setup.py", line 9, in <module>

    import pyfttt

  File "/Users/paulus/dev/temp/pyvenv-test/build/pyfttt/pyfttt/__init__.py", line 7, in <module>

    from pyfttt.sending import *

  File "/Users/paulus/dev/temp/pyvenv-test/build/pyfttt/pyfttt/sending.py", line 3, in <module>

    import requests

ImportError: No module named 'requests'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/paulus/dev/temp/pyvenv-test/build/pyfttt
Storing debug log for failure in /Users/paulus/.pip/pip.log

Steps to reproduce:

mkdir pyvenv-test
python3 pyvenv-test
cd pyvenv-test
# Replace next line on Windows with Scripts\activate.bat
source bin/activate
pip3 install pyfttt

Unable to get value data in IFTTTT

payload = {'value1': value1, 'value2': value2, 'value3': value3}

I've been trying to get home assistant (which imports this module) to send json data to IFTTT and it's not working correctly. Looking at their docs to get anything usable besides the event name (I could be wrong), you need to send it a different way

https://help.ifttt.com/hc/en-us/articles/4405029291163-Parsing-JSON-body-with-filter-code

Basically

Note that the URL for the [Webhooks - Receive a web request with a JSON payload](https://ifttt.com/maker_webhooks/triggers/json_event) trigger is in a slightly different format than the regular IFTTT Webhook URL (https://maker.ifttt.com/trigger/{event}/with/key/{key} vs https://maker.ifttt.com/trigger/{event}/json/with/key/{key}).

If the URL of your web request does not include /json/ as above, the {{JsonPayload}} ingredient will be empty:

So it looks like this should have the /json/ path added if the intention is to be able to use any values

url = 'https://maker.ifttt.com/trigger/{e}/with/key/{k}/'.format(e=event,

Handling negative values

If any value starts with "-" (e.g. "-52,7", "-a") pyfttt fails.

Se below:
Traceback (most recent call last):
File "/home/pi/Documents/kutahaz.py", line 101, in
temp, humi, temp_k])
File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
kwargs).stdout
File "/usr/lib/python3.5/subprocess.py", line 398, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pyfttt', '-k', '
', '-e', '**', '19,5', '-52,7', '-a']' returned non-zero exit status 2

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.