def main():
  init_service(
      port=8185, 
      servicename='ClosestStockExchange',
      userfunction=closeststockexchange,
      args={'stocksymbol':str, 'latitude':str, 'longitude':str},
      returns={'closestStockExchange':str, 'closestStockExchange_lat':str, 'closestStockExchange_long':str}
  )
def main():

  init_service(
      port=8184, 
      servicename='Stock',
      userfunction=stock,
      args={'symbol':str},
      returns={'rate':str, 'companyname':str}
  )
def main():

  init_service(
      port=8183, 
      servicename='Weather',
      userfunction=weather,
      args={'city':str, 'country':str},
      returns={'weather':str}
  )
def main():
  # read data from CSV file
  reader = csv.reader(open('citylatlong.csv', 'r'))
  global citylatlong_data
  citylatlong_data = {}
  for row in reader:
    cityname,adminarea,latlong = row
    #print cityname,adminarea,latlong
    long,lat = latlong.split()
    citylatlong_data[cityname] = { adminarea: {'lat':lat, 'long':long} }

  init_service(
      port=8182, 
      servicename='CityLatLong',
      userfunction=citylatlong,
      args={'cityname':str, 'adminarea':str},
      returns={'lat':str, 'long':str}
  )
def main():
  
  reader = csv.reader(open('companydata.csv', 'r'))
  global companies
  companies = {}
  for row in reader:
    company,stock,city,country = row
    #print company,stock,city,country
    companies[company] = { 'country':country, 'city':city, 'stock':stock }

  init_service(
      port=8181, 
      servicename='CompanyData',
      userfunction=companydata,
      args={'company':str},
      #returns={'CompanyDataResult': {'city':str, 'country':str , 'stock':str}}
      returns={'city':str, 'country':str , 'stock':str}
  )
Example #6
0
server.config["JWT_REFRESH_TOKEN_EXPIRES"] = 86400
jwt = JWTManager(server)

server.debug = config.DEBUG
server.config["SQLALCHEMY_DATABASE_URI"] = config.DB_URI
server.config[
    "SQLALCHEMY_TRACK_MODIFICATIONS"] = config.SQLALCHEMY_TRACK_MODIFICATIONS
db.init_app(server)
db.app = server

cors = CORS(
    server,
    origins=config.ALLOWED_ORIGINS,
    supports_credentials=True,
)

if server.debug:
    import logging
    logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO)

from service import init_service
init_service(config)

for blueprint in vars(routes).values():
    if isinstance(blueprint, Blueprint):
        server.register_blueprint(blueprint,
                                  url_prefix=config.APPLICATION_ROOT)

if __name__ == "__main__":
    server.run(host=config.HOST, port=config.PORT)