import pandas as pd import numpy as np import transport import datetime import io import json import requests def subscribe (self,**args) : """ This function will subscribe an email to a given service (report,notification). If already susbcribed no further action will be performed :email provide a valid email for the free plan. Upgrades will be done via the website :id service identifier accepted values are GOOGLE_DRIVE,DROPBOX,BOX,ONE_DRIVE """ url = "https://the-phi.com/store/smart-top/subscribe" SERVICES=['GOOGLE','DROPBOX','BOX','ONE_DRIVE'] if args['id'].upper() in SERVICES : data = {"email":args['email']} requests.post(url,data=data) pass def log(**args) : """ This function will write to a designated location provided a set of inputs :store mongo,file,couch,api """ # # @TODO: Provide facility to write to a given cloud store (google,one-drive ...) # This will have to be supported by some sort of subscription service # STORE_MAP = {"mongo":"MongoWriter","disk":"DiskWriter","couch":"CouchWriter",'sqlite':'SQLiteWriter'} if 'store' not in args : _id = 'console' else: _id = 'disk' if args['store'] == 'file' else args['store'] _id = 'disk' if _id == 'sqlite' else _id if _id == 'console' : """ We are going to print whatever we have to the console ... using the tool in cli mode """ print() print (args['data']) print () # stream = args['memory'] # stream.write(json.dumps(args['row']) if isinstance(args['row'],dict) else args['row']) # stream.write("\n") else: store_type = ".".join([args['store'],STORE_MAP[_id]]) store_args = args['params'] store = transport.factory.instance(type=store_type,args=store_args) store.write( args['row'])