Comments (4)
We're discussing this on Intercom
from seatsio-python.
I have made changes to sdk for my solution. If you feel perfect please add this to the SDK to get appropriate DICT response which enable user to easily serialize the objects. Please update this as soon as possible. we need to integrate new sdk
`
class EventReportItem:
def init(self, item_data):
self.status = item_data.get("status")
self.label = item_data.get("label")
self.labels = item_data.get("labels")
self.category_label = item_data.get("categoryLabel")
self.category_key = item_data.get("categoryKey")
self.ticket_type = item_data.get("ticketType")
self.order_id = item_data.get("orderId")
self.for_sale = item_data.get("forSale")
self.hold_token = item_data.get("holdToken")
self.section = item_data.get("section")
self.entrance = item_data.get("entrance")
self.num_booked = item_data.get("numBooked")
self.num_free = item_data.get("numFree")
self.num_held = item_data.get("numHeld")
self.capacity = item_data.get("capacity")
self.object_type = item_data.get("objectType")
self.extra_data = item_data.get("extraData")
def to_json(self):
return self.__dict__
class BestAvailableObjects:
def init(self, data):
self.next_to_each_other = data.get("nextToEachOther")
self.objects = data.get("objects")
self.objectDetails = {}
for key, value in iteritems(data.get("objectDetails")):
self.objectDetails[key] = EventReportItem(value).to_json()
def to_json(self):
return self.__dict__`
from seatsio-python.
Hi,
Correct me if I'm wrong, but I don't think we need to add to_json methods. You can convert to json like this:
from json import JSONEncoder
class MyEncoder(JSONEncoder):
def default(self, o):
return o.__dict__
best_available_objects_as_json = MyEncoder().encode(best_available_objects)
from seatsio-python.
perfect thanks @mroloux
from seatsio-python.
Related Issues (2)
- PyPi package incomplete? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seatsio-python.