Beispiel #1
0
import json
import uuid
from spyne import Application, srpc, ServiceBase, Array, Integer, Unicode, Iterable, ComplexModel
from spyne.protocol.soap import Soap11
from flask import Flask
from flask.ext.spyne import Spyne
import time
import db
from lxml import etree
from configobj import ConfigObj
import qbxml

app = Flask(__name__)
spyne = Spyne(app)

config = ConfigObj('config.ini')


class qbwcSessionManager():
    def __init__(self, sessionQueue=[]):
        self.sessionQueue = sessionQueue  # this is a first in last out queue, i.e. a stack

    def check_requests(self):
        #checks the process requestQueue to see if there are any requests, if so, put them in sessionQueue
        while not app.config['requestQueue'].empty():
            req = app.config['requestQueue'].get()
            #interpret the msg fire off the correct function it will return a session to be put in the sessionqueue
            if req['job'] == 'syncQBtoDB':
                syncQBtoDB()
            elif req['job'] == 'retrieve_invoices':
                retrieve_invoices()
Beispiel #2
0
# -*- coding: utf-8 -*-

from flask.ext.spyne import Spyne
from spyne.protocol.soap import Soap11
from spyne.model.primitive import Unicode, Integer
from spyne.model.complex import Iterable
from oauth import app
from oauth import lib

soap = Spyne(app)


class TestService(soap.Service):
    __service_url_path__ = '/soap/'
    __in_protocol__ = Soap11(validator='lxml')
    __out_protocol__ = Soap11()

    @soap.srpc(Unicode, Integer, _returns=Iterable(Unicode))
    def echo(str, cnt):
        for i in range(cnt):
            yield str