Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (33 sloc) 1.071 kb
import argparse
import json
from lib import twitter
query = 'iron.io'
parser = argparse.ArgumentParser(
description="Simple argument parser")
parser.add_argument("-payload", type=str, required=False,
help="The location of a file containing a JSON payload.")
parser.add_argument("-d", type=str, required=False,
help="Directory")
parser.add_argument("-e", type=str, required=False,
help="Environment")
parser.add_argument("-id", type=str, required=False,
help="Task id")
args = parser.parse_args()
pd = False
if args.payload is not None:
payload = json.loads(open(args.payload).read())
if 'query' in payload:
query = payload['query']
#Workers code
if query is not None:
print("Search by query")
results = twitter.search(query)
print(results)
myInput = open('myfile.txt','w+')
print("now writing to file")
myInput.write(results[0]['text'])
myInput.close()
myInput = open('myfile.txt','r')
print("now reading from file")
res_from_file = myInput.read()
print(res_from_file)
Jump to Line
Something went wrong with that request. Please try again.