示例#1
0
 def __init__(self, info={}, session=None, person=None):
     self.session = session or TembooSession(
         "jordanemedlock", "jordanemedlockcom",
         "aB8hQizrTLhyOUitwNdnxvddWa3Fw6ZG")
     self.weather = None
     PowerDict.__init__(self, info)
     Capability.__init__(self, person)
 def __init__(self):
     """
     Set up Temboo session. Create a target folder in Dropbox.
     """
     self.session = TembooSession(TEMBOO_ACCOUNT_NAME,
                                  TEMBOO_APPLICATIONKEY_NAME,
                                  TEMBOO_APPLICATIONKEY)
示例#3
0
def getTwitterData(artist):
    #Heavily inspired by the code on the temboo twitter api page
    print 'Getting Twitter Data For '+ artist + '...',
    # Create a session with your Temboo account details
    session = TembooSession("marcusgreer", "myFirstApp", "9d024f2abbdd4fc8980efcff1322200f")

    # Instantiate the Choreo
    tweetsChoreo = Tweets(session)

    # Get an InputSet object for the Choreo
    tweetsInputs = tweetsChoreo.new_input_set()

    # Set the Choreo inputs
    tweetsInputs.set_Count("200")
    tweetsInputs.set_AccessToken("61327408-6JWhryRxaGXfmTwXvKSnMH8MvnftMLcbqP70nI8QO")
    tweetsInputs.set_Query(artist)
    tweetsInputs.set_AccessTokenSecret("CeBxRayK6tKLkjOtbZ5lhEX1j7eTMeJ9T552pd7v80SBz")
    tweetsInputs.set_ConsumerSecret("OTxmfO2jNc6KqPJeiIcfIvnlmzQgjJS3oqLm6Nwuag9GnY6wID")
    tweetsInputs.set_ConsumerKey("bmz3jbgy6THJ5TD5I3xBxRaec")
    tweetsInputs.set_ResultType("popular")

    # Execute the Choreo
    tweetsResults = tweetsChoreo.execute_with_results(tweetsInputs)

    # Print the Choreo outputs
    summ = 0
    tweets = tweetsResults.get_Response()
    for status in tweets.split(',"retweet_count":')[1:]:
        summ += eval(status.split(',"favorite_count"')[0])
    with open('Popularity.txt','a') as fileOut: fileOut.write(artist+','+str(summ)+'\n')
    print 'Done!'
示例#4
0
def upload(strData):  #번호4자리
    # Create a session with your Temboo account details
    session = TembooSession("bb20170815", "myFirstApp",
                            "WMENs2Yj3qmoY8ydMLYulDnWn67IoZFS")  #매달 바뀌는 듯

    # Instantiate the Choreo
    uploadChoreo = Upload(session)

    # Get an InputSet object for the Choreo
    uploadInputs = uploadChoreo.new_input_set()
    uploadInputs.set_AccessToken(
        "1rshKArZ-mAAAAAAAAAAC-FE7-1OOeVCK5XqR5LbcShXzWN9TLDpIVgSU0sjbCKL")

    fileNames = []
    imgFileName = strData + ".IMG.jpg"
    locFileName = strData + ".LOC.html"
    fileNames.append(imgFileName)
    fileNames.append(locFileName)

    for fileName in fileNames:
        # Encode file
        with open(fileName, "rb") as f:
            encoded_string = base64.b64encode(f.read())

        # Set the Choreo inputs
        serverPath = "/suspect/" + fileName
        uploadInputs.set_Path(serverPath)
        uploadInputs.set_FileContent(encoded_string)

        # Execute the Choreo
        uploadResults = uploadChoreo.execute_with_results(uploadInputs)

        # Print the Choreo outputs
        print("Response: " + uploadResults.get_Response())
示例#5
0
    def render_POST(self, request):
        print("Enviando petición a temboo")
        # Create a session with your Temboo account details
        session = TembooSession('almanaranja', 'MyFirstApp',
                                '1LB6hWkQNaFcBYD7UhRsz2AxlRth6GUS')

        # Act as a proxy for the JS SDK
        tembooProxy = TembooProxy()

        # Instantiate the Choreo
        getValuesChoreo = GetValues(session)

        # Add Choreo proxy with an ID matching that specified by the JS SDK client
        tembooProxy.add_choreo('jsGetValues', getValuesChoreo)

        # Get an InputSet object for the Choreo
        getValuesInputs = getValuesChoreo.new_input_set()

        # Set credential to use for execution
        getValuesInputs.set_credential('GoogleSheetsAccount')

        tembooProxy.set_default_inputs('jsGetValues', getValuesInputs)

        # Whitelist inputs
        tembooProxy.allow_user_inputs('jsGetValues', 'Range')
        tembooProxy.allow_user_inputs('jsGetValues', 'SpreadsheetID')

        # Execute the requested Choreo. httpPostData contains the contents of the JavaScript client POST
        # request. How this variable is populated will depend on your Python web server implementation.
        result = tembooProxy.execute(request.args['temboo_proxy'][0])

        return result
示例#6
0
def sendDM(time, text):
    session = TembooSession('jgillard', 'TwitBot1', 'f7671f639f6a448d94d82950ab7f74e0')
    sendDirectMessageChoreo = SendDirectMessage(session)
    sendDirectMessageInputs = sendDirectMessageChoreo.new_input_set()
    sendDirectMessageInputs.set_credential('JamesGYun')
    sendDirectMessageInputs.set_Text(time + ' ' + text)
    sendDirectMessageInputs.set_ScreenName("jamesmgillard")
    sendDirectMessageChoreo.execute_with_results(sendDirectMessageInputs)
示例#7
0
    def __init__(self):
        """ Set up a Temboo session. """
        self.session = TembooSession(TEMBOO_ACCOUNT_NAME,
                                     TEMBOO_APPLICATIONKEY_NAME,
                                     TEMBOO_APPLICATIONKEY)

        # Has the user's Google Calendar been modified within this instance's
        # lifetime?
        self.modified = False
        # ID of calendar to which we want to add events.
        self.calendar_id = None
示例#8
0
def locationGPS():
    from temboo.Library.Google.Geocoding import GeocodeByAddress
    from temboo.core.session import TembooSession
    locale = callback()
    session = TembooSession('jack727', 'myFirstApp', 'ZjdczC9s7nPiHX80gyXx7YxkoYVDQRBK')
    geocodeByAddressChoreo = GeocodeByAddress(session)
    geocodeByAddressInputs = geocodeByAddressChoreo.new_input_set()
    geocodeByAddressInputs.set_Address(str(locale))
    geocodeByAddressResults = geocodeByAddressChoreo.execute_with_results(geocodeByAddressInputs)
    Talk('Okay ' + GlobalFile.user + ' here is your location')
    Talk("Longitude: " + geocodeByAddressResults.get_Longitude,1())
    Talk("Latitude: " + geocodeByAddressResults.get_Latitude, 1())
示例#9
0
def searching(string):
    print string
    session = TembooSession("alexandraorth", "myFirstApp",
                            "d7be0cc1-7cdc-42c9-8")
    choreo = Query(session)
    inputs = choreo.new_input_set()
    inputs.set_SinceId(249672500605222913)
    inputs.set_Query(string + " have my babies")
    results = choreo.execute_with_results(inputs)
    str = results.get_Response().encode('utf-8')
    num = str.count('statuses')
    return num
示例#10
0
def upload_to_dropbox(file_name,file_contents):
    # Create a session with your Temboo account details
    session = TembooSession("temboosign", "myFirstApp", "OOqKKwbTUhELCgBZC5T2CuXmJ9CqYvrb")

    # Instantiate the Choreo
    uploadChoreo = Upload(session)

    # Get an InputSet object for the Choreo
    uploadInputs = uploadChoreo.new_input_set()

    # Set the Choreo inputs
    file_name=file_name.replace(' ','')
    print("FILE"+file_name)
    uploadInputs.set_Path("/Apps/Parrot Teleprompter/"+file_name+".txt")
    uploadInputs.set_FileContent(file_contents)
    uploadInputs.set_ContentType("text/plain")
    uploadInputs.set_AccessToken("cG2kM3HuQMAAAAAAAAAAKBefSA5DdwNZ0Ll1sMjYyMShP8gCDt2FXLqwZrwbVJG6")

    # Execute the Choreo
    uploadResults = uploadChoreo.execute_with_results(uploadInputs)
    if DEBUG:
       print(format(uploadResults))
示例#11
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import base64
import sys
from temboo.core.session import TembooSession
from temboo.Library.Facebook.Publishing import UploadPhoto

print str(sys.argv[1])

with open(str(sys.argv[1]), "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())

session = TembooSession('ACCOUNT_NAME', 'APP_KEY_NAME', 'APP_KEY_VALUE')
uploadPhotoChoreo = UploadPhoto(session)

# Get an InputSet object for the choreo
uploadPhotoInputs = uploadPhotoChoreo.new_input_set()

# Set inputs
uploadPhotoInputs.set_AccessToken("ACCESS_TOKEN")
uploadPhotoInputs.set_Message("MESSAGE")
uploadPhotoInputs.set_AlbumID("ALBUM_ID")
uploadPhotoInputs.set_Photo(encoded_string)

# Execute choreo
uploadPhotoResults = uploadPhotoChoreo.execute_with_results(uploadPhotoInputs)
示例#12
0
#!/usr/bin/env python
import sys
sys.path.insert(0, '/usr/lib/python2.7/bridge/')
from temboo.Library.Yahoo.Weather import GetWeatherByAddress
from temboo.core.session import TembooSession
import json
from model import WeatherInfo as wi
from model import Weather as w
from model import Forecast as f
from bridgeclient import BridgeClient as bridgeclient
from datetime import datetime

session = TembooSession("marsland", "SmartClock", "bkOW4wZpfNVuXC2A6f52z7Ja4oAukXZL")
getWeatherByAddressChoreo = GetWeatherByAddress(session)
getWeatherByAddressInputs = getWeatherByAddressChoreo.new_input_set()
getWeatherByAddressInputs.set_ResponseFormat("json")
getWeatherByAddressInputs.set_Address("1 beenleigh ave 5087 sa")
getWeatherByAddressInputs.set_Day("4")
getWeatherByAddressInputs.set_Units("c")
getWeatherByAddressResults = getWeatherByAddressChoreo.execute_with_results(getWeatherByAddressInputs)

# print("Response: " + getWeatherByAddressResults.get_Response())

res = json.loads(getWeatherByAddressResults.get_Response())
forecasts = res["channel"]["item"]["yweather:forecast"]
current= w.create(code = getWeatherByAddressResults.get_ForecastCode(),  temperature = getWeatherByAddressResults.get_Temperature(),text= getWeatherByAddressResults.get_ForecastText(), humidity = getWeatherByAddressResults.get_Humidity())

weathers = {}
counter = 0
for forecast in forecasts:
  weathers[counter] = f.create(code= forecast["@code"], high= forecast["@high"], low = forecast["@low"], text = forecast["@text"] )
#Twitter Vending Machine
from temboo.Library.Twitter.DirectMessages import SendDirectMessage
from temboo.core.session import TembooSession
from temboo.Library.Twitter.Timelines import LatestMention
from temboo.core.session import TembooSession
import random
import urllib
rand_num = random.randint(2000,5000)
# Create a session with your Temboo account details
session = TembooSession("anandjbangad", "myFirstApp", "2fb5SR7S5rXwoBBNc4hK9QJvfeq1LHg4")
latestMentionChoreo = LatestMention(session)
latestMentionInputs = latestMentionChoreo.new_input_set()
# Instantiate the Choreo
sendDirectMessageChoreo = SendDirectMessage(session)
url = "http://www.anandbangad.com/codewrite.php?code="
# Get an InputSet object for the Choreo
sendDirectMessageInputs = sendDirectMessageChoreo.new_input_set()

latestMentionInputs.set_ConsumerKey("8KMFkb3BxAUteOHVxdtavs2jy")
latestMentionInputs.set_AccessToken("2549604530-CwKCLmFLpyJxeb2kS1ddAS6QnRRN9AXH1BiInXc")
latestMentionInputs.set_ConsumerSecret("vy1pYfVVtUut7dRqmkMj9v3MkBkBME8Ib4tllWqGQl936dPN54")
latestMentionInputs.set_AccessTokenSecret("mhwBhp5Xz4gjX6wRbvm8MIAMDFxszVcgTPUovUwjqwmmh")

# Execute the Choreo
latestMentionResults = latestMentionChoreo.execute_with_results(latestMentionInputs)

# Print the Choreo outputs
print("ID: " + latestMentionResults.get_ID())
print("Limit: " + latestMentionResults.get_Limit())
print("Remaining: " + latestMentionResults.get_Remaining())
print("Reset: " + latestMentionResults.get_Reset())
示例#14
0
# Import correct libraries
import base64
import sys
from datetime import datetime
from temboo.core.session import TembooSession
from temboo.Library.Google.Gmail import SendEmail
from temboo.Library.Dropbox.FilesAndMetadata import UploadFile

print str(sys.argv[1])

# Encode image
with open(str(sys.argv[1]), "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())

# Declare Temboo session and Choreo to upload files
session = TembooSession("U-S-E-R", "A-P-P", "K-E-Y")

uploadFileChoreo = UploadFile(session)

# Get an InputSet object for the choreo
uploadFileInputs = uploadFileChoreo.new_input_set()

# Set inputs
uploadFileInputs.set_FileName(sys.argv[1])
uploadFileInputs.set_FileContents(encoded_string)

# Set the Choreo inputs
uploadFileInputs.set_AccessToken("T-O-K-E-N")
uploadFileInputs.set_AppKey("A-P-P-K-E-Y")
uploadFileInputs.set_AccessTokenSecret("T-O-K-E-N")
uploadFileInputs.set_AppSecret("S-E-C-R-E-T")
示例#15
0
from temboo.Library.Utilities.JSON import GetValuesFromJSON
from temboo.core.session import TembooSession

# Create a session with your Temboo account details
session = TembooSession("accountName", "myFirstApp", "abc123xxxxxxxxxxxxxx")

# Instantiate the Choreo
getValuesFromJSONChoreo = GetValuesFromJSON(session)

# Get an InputSet object for the Choreo
getValuesFromJSONInputs = getValuesFromJSONChoreo.new_input_set()

# Execute the Choreo
getValuesFromJSONResults = getValuesFromJSONChoreo.execute_with_results(
    getValuesFromJSONInputs)

# Print the Choreo outputs
print("Response: " + getValuesFromJSONResults.get_Response())
from temboo.Library.YouTube.Search import ListSearchResults
from temboo.Library.YouTube.Playlists import ListPlaylistsByChannel
from temboo.Library.YouTube.PlaylistItems import ListItemsByPlaylist
from temboo.core.session import TembooSession
import json
import sys

session = TembooSession("jordanemedlock", "BlackPin",
                        "yQbxb5hKgUehRlnfuqVJD7KF0v8BDQeX")


def find_channel_id(channel_name):
    choreo = ListSearchResults(session)

    inputs = choreo.new_input_set()

    inputs.set_Query(channel_name)

    results = choreo.execute_with_results(inputs)

    response = results.get_Response()

    obj = json.loads(response)

    items = obj['items']

    for item in items:
        if item['id']['kind'] == 'youtube#channel':
            return item['id']['channelId']

示例#17
0
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from config import FB_APP_ID, FB_APP_SECRET, FORWARDING_URL
from config import TEMBOO_ACCOUNT_NAME, TEMBOO_APP_NAME, TEMBOO_APP_KEY
from temboo.Library.Facebook.OAuth import InitializeOAuth
from temboo.Library.Facebook.OAuth import FinalizeOAuth
from temboo.Library.Facebook.Reading import User
from temboo.core.session import TembooSession
import uuid
from django.template import RequestContext, loader
from facebookUtils import *
# Create a Temboo session object
from django.utils.encoding import iri_to_uri

SESSION = TembooSession(TEMBOO_ACCOUNT_NAME, TEMBOO_APP_NAME, TEMBOO_APP_KEY)
CUSTOMCALLBACKID = None

STATIC_WORDS_TO_SERACH = []


def home(request):
    template = loader.get_template('templates/main.html')
    context = RequestContext(request, {
        'latest_question_list': '1',
    })
    return HttpResponse(template.render(context))


def get_login_url_to_serach_with_and(request):
    global STATIC_WORDS_TO_SERACH
# Script to upload files to Dropbox

# Import correct libraries
import base64
import sys
from temboo.core.session import TembooSession
from temboo.Library.Dropbox.FilesAndMetadata import UploadFile

print str(sys.argv[1])

# Encode image
with open(str(sys.argv[1]), "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())

# Declare Temboo session and Choreo to upload files
session = TembooSession("ismarthome88", "myFirstApp",
                        "42d33889ea9a45bd8c7bed97a2ccdf17")
uploadFileChoreo = UploadFile(session)

# Get an InputSet object for the choreo
uploadFileInputs = uploadFileChoreo.new_input_set()

# Set inputs
uploadFileInputs.set_AppKey("412wvvs18fz8626")
uploadFileInputs.set_AppSecret("426ckdalhh3tk3t")
uploadFileInputs.set_AccessToken("phgmf2fgdv8rge8u")
uploadFileInputs.set_AccessTokenSecret("q4qynhfgileze17")

uploadFileInputs.set_FileName(str(sys.argv[1]))
uploadFileInputs.set_FileContents(encoded_string)
uploadFileInputs.set_Root("sandbox")
示例#19
0
googleplusIDs = []

# All fields across all platforms to be fetched
all_fields = {
    'name', 'displayName', 'formattedName', 'username', 'profile_url',
    'screen_name', 'publicProfileUrl', 'email', 'emails', 'emailAddress',
    'current_location', 'location', 'currentLocation', 'placesLived',
    'mainAddress', 'locale', 'education', 'organizations', 'educations',
    'work', 'positions', 'lang', 'language', 'languages', 'about_me',
    'description', 'aboutMe', 'tagline', 'summary', 'birthday_date',
    'birthday', 'dateOfBirth', 'age_range', 'ageRange', 'sex', 'gender',
    'timezone', 'time_zone', 'website', 'url', 'urls', 'memberUrlResources'
}

session = TembooSession(config['temboo']['userID'],
                        config['temboo']['app']['name'],
                        config['temboo']['app']['key'])


def search(APIkey, userID, cseID, query, start):
    q = "https://www.googleapis.com/customsearch/v1?key=" + APIkey + "&cx=" + userID + ":" + cseID + "&q=" + urllib.quote(
        query, '') + "&start=" + str(start) + "&num=" + str(num) + "&alt=json"
    response = json.loads(urllib.urlopen(q).read())
    results.append(response)
    if response.get('queries'):
        totalResults = response.get('queries').get('request')[0].get(
            'totalResults', 0)
        if int(totalResults) > 100 and int(start) < 21:
            search(APIkey, userID, cseID, query, start + num)

    9619, 3494, 8254, 2092, 9480, 6971, 2965, 3350, 8157, 3461, 3495, 5192,
    6946, 8231, 7920, 8821, 8396, 9819, 8273, 6475, 6391, 3137, 6599, 6377,
    7930, 2267, 7630, 9946, 2581, 2182, 9274, 1774, 7824, 9393, 8915, 2137,
    1463, 1277, 3416, 4041, 2815, 4954, 3340, 7479, 4929, 1400, 7644, 9556,
    3765, 4683, 1421, 5683, 5274, 7024, 6722, 8026, 5680, 1168, 6346, 9603,
    7216, 1459, 5084, 8208, 2417, 6886, 6486, 4425, 2173, 3422, 8260, 8362,
    5275, 1187, 7689, 2791, 5433, 1368, 1268, 9373, 2759, 2299, 9769, 2507,
    6246, 4820, 6405, 3681, 4755, 6841, 7071, 5972, 3027, 4625, 1906, 2865,
    5277, 7426, 9618, 3050, 8098, 7769, 2518, 6217, 6032, 3399, 8138, 7693,
    1545, 1003, 2158, 3914, 2260, 6786, 6597, 1376, 8729, 8314, 1152, 7640,
    8049, 5314, 9049, 3791, 6193, 2536, 2176, 5109, 2692, 7588, 2452, 5365,
    7521, 1239, 8102, 7962, 3193, 2030, 1022, 7581, 8536, 9644, 6830, 7406,
    2735, 8549, 9799
]
# Create a session with your Temboo account details
session = TembooSession("anandjbangad", "myFirstApp",
                        "hLGLdKwzIIqM2NK1tsBX2FFjyLEHg0TH")
#session = TembooSession("anandjbangad", "myFirstApp", "2fb5SR7S5rXwoBBNc4hK9QJvfeq1LHg4")
latestMentionChoreo = LatestMention(session)
latestMentionInputs = latestMentionChoreo.new_input_set()
# Instantiate the Choreo
sendDirectMessageChoreo = SendDirectMessage(session)
url = "http://www.anandbangad.com/codewrite.php?code="
# Get an InputSet object for the Choreo
sendDirectMessageInputs = sendDirectMessageChoreo.new_input_set()

latestMentionInputs.set_ConsumerKey("8KMFkb3BxAUteOHVxdtavs2jy")
latestMentionInputs.set_AccessToken(
    "2549604530-CwKCLmFLpyJxeb2kS1ddAS6QnRRN9AXH1BiInXc")
latestMentionInputs.set_ConsumerSecret(
    "vy1pYfVVtUut7dRqmkMj9v3MkBkBME8Ib4tllWqGQl936dPN54")
latestMentionInputs.set_AccessTokenSecret(
示例#21
0
#This bot is created for educational purposes. It is made for the IACD course at CMU, spring 2015.
#It makes use of several Temboo libraries and could not have existed without it.
#Thomas Langerak, www.thomaslangerak.nl

import time
from temboo.Library.Twitter.Timelines import LatestMention
from temboo.Library.Twitter.Tweets import StatusesUpdate
from temboo.Library.Bitly.Links import ShortenURL
from temboo.core.session import TembooSession

# Create a session with your Temboo account details
session = TembooSession("tlangerak", "myFirstApp",
                        "c5ae74ae20be474583c9e2c22252ed38")

# Initiate the Choreos
latestMentionChoreo = LatestMention(session)
statusesUpdateChoreo = StatusesUpdate(session)

# Get an InputSet object for the Choreos
latestMentionInputs = latestMentionChoreo.new_input_set()
statusesUpdateInputs = statusesUpdateChoreo.new_input_set()

# Set the Choreos inputs
latestMentionInputs.set_AccessToken("")
latestMentionInputs.set_AccessTokenSecret("")
latestMentionInputs.set_ConsumerSecret("")
latestMentionInputs.set_ConsumerKey("")

statusesUpdateInputs.set_AccessToken("")
statusesUpdateInputs.set_AccessTokenSecret("")
statusesUpdateInputs.set_ConsumerSecret("")
示例#22
0
# Script to upload files to Dropbox

# Import correct libraries
import base64
import sys
from temboo.core.session import TembooSession
from temboo.Library.Dropbox.Files import Upload

print str(sys.argv[1])

# Encode image
with open(str(sys.argv[1]), "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())

# Declare Temboo session and Choreo to upload files
session = TembooSession('ratulahmed', 'myFirstApp', 'EooH6NGW7ZAYe9iqsxnNAhkV7jPehjgW')
uploadFileChoreo = Upload(session)

# Get an InputSet object for the choreo
uploadFileInputs = uploadFileChoreo.new_input_set()

# Set inputs
#uploadFileInputs.set_AppSecret("l625itj68ec4pyy")
uploadFileInputs.set_AccessToken("RyzY2OBYynAAAAAAAAABhY5nYfF1q1dmQ3RAH0tvUMxW3vSuN48vFpE2L2yKg7YB")
uploadFileInputs.set_Path(str(sys.argv[1]))
#uploadFileInputs.set_AccessTokenSecret("yourTokenSecret")
#uploadFileInputs.set_AppKey("ekz2iughorivllz")
uploadFileInputs.set_FileContent(encoded_string)
#uploadFileInputs.set_Root("sandbox")

# Execute choreo
示例#23
0
        # Show the state for debugging.
        #print ("state=", state)

        # If state has changed, send the state to Google Spreadsheet through Temboo.
        if state != lastState:
            lastState = state
            if state == 0:
                stateText = "Released"
            else:
                stateText = "Pressed"
            print("Sending stateText=", stateText)

            # Send the state to the Google Spreadsheet through Temboo.
            # Create a session with your Temboo account details
            session = TembooSession("lupyuen", "myFirstApp",
                                    "2e0421546ea248d4a5cd2029f2979e23")

            # Instantiate the Choreo
            addListRowsChoreo = AddListRows(session)

            # Get an InputSet object for the Choreo
            addListRowsInputs = addListRowsChoreo.new_input_set()

            # Set credential to use for execution
            addListRowsInputs.set_credential('SensorData')

            # Set the data to be added
            addListRowsInputs.set_RowsetXML("""
            <rowset>
            <row>
            <Timestamp>{0}</Timestamp>
示例#24
0
from temboo.core.session import TembooSession
import json,serial, time

#serial address
#you will need to change this to your Arduino's usb connection
#on unix flavored os type "ls /dev/tty*" to find it
ttyAddress = "/dev/tty.usbmodem14311101" 

#consts: fill in you api and temboo info here
accesstoken = ""
sessionAccount = ""
sessionApp = ""
sessionID = ""

# Create a session with your Temboo account details
session = TembooSession(sessionAccount, sessionApp, sessionID)

# Instantiate the ChoreoS

getRecentMediaForUserChoreo = GetRecentMediaForUser(session)
# Create a session with your Temboo account details
print("********************")
# Get an InputSet object for the Choreo
getRecentMediaForUserInputs = getRecentMediaForUserChoreo.new_input_set()

# Set the Choreo inputs
getRecentMediaForUserInputs.set_AccessToken(accesstoken)
#only get the last post = 1
getRecentMediaForUserInputs.set_Count("1")

# Execute the Choreo
# Imports
import base64
import sys

from temboo.Library.Amazon.S3 import PutObject
from temboo.core.session import TembooSession

# Encode image
with open(str(sys.argv[1]), "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())

# Create a session with your Temboo account details
session = TembooSession(USER_NAME, APP_NAME, KEY)

# Instantiate the Choreo
putObjectChoreo = PutObject(session)

# Get an InputSet object for the Choreo
putObjectInputs = putObjectChoreo.new_input_set()

# Set the Choreo inputs
putObjectInputs.set_FileContents(encoded_string)
putObjectInputs.set_BucketName(BUCKET_NAME)
putObjectInputs.set_UserRegion(REGION)
putObjectInputs.set_FileName(IMAGE_NAME)
putObjectInputs.set_AWSAccessKeyId(AWS_ACCESS_KEY)
putObjectInputs.set_AWSSecretKeyId(AWS_SECRET_KEY)

# Execute the Choreo
putObjectResults = putObjectChoreo.execute_with_results(putObjectInputs)
# Script para importar imagens para o Dropbox

# Importa a bibliotecas
import base64
import sys
from temboo.core.session import TembooSession
from temboo.Library.Dropbox.FilesAndMetadata import UploadFile

print str(sys.argv[1])

# Codificação da imagem
with open(str(sys.argv[1]), "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())

# Declara a sessão Temboo e Choero para envio de arquivos.
session = TembooSession('yourSession', 'yourApp', 'yourKey')
uploadFileChoreo = UploadFile(session)

# Obtem um conjunto de objetos de entrada para o Choreo
uploadFileInputs = uploadFileChoreo.new_input_set()

# Configuração das entradas
uploadFileInputs.set_AppSecret("yourAppSecret")
uploadFileInputs.set_AccessToken("yourAccessToken")
uploadFileInputs.set_FileName(str(sys.argv[1]))
uploadFileInputs.set_AccessTokenSecret("yourTokenSecret")
uploadFileInputs.set_AppKey("yourAppKey")
uploadFileInputs.set_FileContents(encoded_string)
uploadFileInputs.set_Root("sandbox")

# Executa choreo
示例#27
0
from temboo.Library.Twitter.Tweets import UpdateWithMedia
from temboo.core.session import TembooSession
from argparse import ArgumentParser
 
# ArgumentParser con una descripción de la aplicación 
parser = ArgumentParser(description='%(prog)s is an ArgumentParser demo')
 
# Argumento posicional. Los argumentos posicionales son obligatorios.
parser.add_argument('arg1')
parser.add_argument('arg2')

args = parser.parse_args()


# Create a session with your Temboo account details
session = TembooSession("alvarorobotronica", "myFirstApp", "9UGNDGB8sa9Z6Lpm0odgb3MCn08vCu2m")

# Instantiate the Choreo
updateWithMediaChoreo = UpdateWithMedia(session)

# Get an InputSet object for the Choreo
updateWithMediaInputs = updateWithMediaChoreo.new_input_set()

# Set credential to use for execution
updateWithMediaInputs.set_credential('empathytool')

# Set the Choreo inputs
import base64
with open("/var/www/apps/"+args.arg2+"/html/images/local-image.jpg", "rb") as image_file:
            foto = base64.b64encode(image_file.read())
updateWithMediaInputs.set_StatusUpdate(args.arg1)
示例#28
0
import base64
import sys
from temboo.Library.Dropbox.Files import Upload
from temboo.core.session import TembooSession

print str(sys.argv[1])

# Encode image
with open(str(sys.argv[1]), "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())

# Create a session with your Temboo account details
session = TembooSession("Temboo Account", "Name of Temboo App",
                        "Temboo Application Key")

# Instantiate the Choreo
uploadChoreo = Upload(session)

# Get an InputSet object for the Choreo
uploadInputs = uploadChoreo.new_input_set()

# Set the Choreo inputs
#uploadInputs.set_Path("/test3.txt")
#uploadInputs.set_FileContent("Hello World")
uploadInputs.set_FileName(str(sys.argv[1]))
uploadInputs.set_AccessToken("Access token create with OAuth")
uploadInputs.set_FileContents(encoded_string)
uploadInputs.set_Root("sandbox")

# Execute the Choreo
uploadResults = uploadChoreo.execute_with_results(uploadInputs)
示例#29
0
import base64
import time
import datetime
from temboo.Library.Dropbox.FilesAndMetadata import UploadFile
from temboo.core.session import TembooSession

# Encode image
picture = open("/mnt/sda1/arduino/alarm.jpg", "r")
picture_b64 = base64.b64encode(picture.read())

# Timestamp
ts = time.time() - 21600
st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %I:%M%p')

# Create a session with your Temboo account details
session = TembooSession("philippschulte", "myFirstApp",
                        "7ca916a326c44dc5b32d6012546996fe")

# Instantiate the Choreo
uploadFileChoreo = UploadFile(session)

# Get an InputSet object for the Choreo
uploadFileInputs = uploadFileChoreo.new_input_set()

# Set the Choreo inputs
uploadFileInputs.set_AppSecret("40djxoj6d4x6typ")
uploadFileInputs.set_AccessToken("ejpytk1m9tieadjc")
uploadFileInputs.set_FileName(st)
uploadFileInputs.set_AccessTokenSecret("bf24cbyndgffwjj")
uploadFileInputs.set_AppKey("38l45ypud1g2ka2")
uploadFileInputs.set_FileContents(picture_b64)
uploadFileInputs.set_Root("sandbox")
示例#30
0
        state = grovepi.digitalRead(button)

        # Show the state for debugging.
        print("state=", state)
        # If state has changed, send the state to Google Spreadsheet through Temboo.
        if state != lastState:
            lastState = state
            if state == 0:
                stateText = "Released"
            else:
                stateText = "Pressed"
            print("Sending stateText=", stateText)

            # Send the state to the Google Spreadsheet through Temboo.
            # Create a session with your Temboo account details
            session = TembooSession("YOURUSERID", "YOURAPPNAME", "YOURAPPKEY")

            # Instantiate the Choreo
            addListRowsChoreo = AddListRows(session)

            # Get an InputSet object for the Choreo
            addListRowsInputs = addListRowsChoreo.new_input_set()

            # Set credential to use for execution
            addListRowsInputs.set_credential('SensorData')

            # Set the data to be added
            addListRowsInputs.set_RowsetXML("""
            <rowset>
            <row>
            <Timestamp>{0}</Timestamp>