Revision fa9cae7e pithos/lib/queue.py

b/pithos/lib/queue.py
33 33

  
34 34
import pika
35 35
import json
36
import uuid
36 37

  
37 38
from urlparse import urlparse
39
from time import time
38 40

  
39 41

  
40 42
def exchange_connect(exchange, vhost='/'):
......
89 91
def queue_start(conn):
90 92
    connection, channel, exchange = conn
91 93
    channel.start_consuming()
94

  
95
class Receipt(object):
96
    def __init__(self, client, user, resource, value, details=None):
97
        self.eventVersion = 1
98
        self.id = str(uuid.uuid4())
99
        self.timestamp = int(time() * 1000)
100
        self.clientId = client
101
        self.userId = user
102
        self.resource = resource
103
        self.value = value
104
        if details:
105
            self.details = details
106
    
107
    def format(self):
108
        return self.__dict__

Also available in: Unified diff