Date post: | 17-Jul-2015 |
Category: |
Technology |
Upload: | tom-paulus |
View: | 40 times |
Download: | 0 times |
@tompaulus
sudo pip install fancyhands
Install FancyHands SDK - Python
sudo easy_install pip
git clone https://github.com/fancyhands/fancyhands-python.git
python setup.py install
dir fancyhands-python
@tompaulus
HelloWorld.py
from fancyhands import FancyhandsClient from datetime import datetime, timedelta api_key = '<CONSUMER KEY>' secret = '<CONSUMER SECRET>' client = FancyhandsClient(api_key, secret) """ Client is our interface to FancyHands Once we have initialized it, it will remember who we are thought the file """ def reddit(phone_number): """ Get the top story off of or Reddit and have phone_number be called telling them the title :param phone_number: The Phone Number of who should be called :type phone_number: str """ title = "Let me know what's new on the internet!" description = "Go to Reddit, and find the title of the top story. Call me at %s and tell me that title." # %s will be replaced with a phone number when we use the variable in a function call bid = 1.50 expiration_date = datetime.now() + timedelta(1) client.standard_create(title, description % phone_number, bid, expiration_date) return True reddit("(111) 111-1111")
@tompaulus
Response.py
def call_and_react(phone_number): """ Call phone_number and prank them, then get their reaction :param phone_number: The Phone Number of who should be called :type phone_number: str """ title = "Prank call my friend!" description = "Call %s. Ask if their refrigerator is running." \ "When they say 'yes', tell them 'Well you better go catch it!'." bid = 3.00 expiration_date = datetime.now() + timedelta(1) custom_fields = [ { 'label': 'Response', 'type': 'textarea', 'description': 'Their response to the prank.', 'order': 1, "required": True } ] client.custom_create(title, description % phone_number, bid, expiration_date, custom_fields) return True call_and_react("(555) 555-555")
@tompaulus
WebHooks are an HTTP POST callback request sent to URL of a user's choice in response to some event occurring. They offer simple and effective server to server
communication without long running connections.
RequestBin is a service which receives all incoming requests and logs them for your later review. We’ll use it to quickly see
what sort of data Fancy Hands gives our app.
http://requestb.in/
@tompaulus
https://studentrnd.org/build/prank-calling-friends-with-fancy-hands
@tompaulus
Code: https://github.com/tpaulus/CD-FancyHands
Slides: http://tpaulus.github.io/CD-FancyHands/