getting key-value pairs of custom object in python
<p>I am working with the <a href="http://boto.cloudhackaers.com/en/latest/ref/mws.html#" rel="nofollow noreferrer">python boto package called mws</a> for interfacing with Amazon MWS.  But I think this is also a general python question, still not sure. I am using the <code>list_oder_items</code> method to get the product items for an order.  </p>

<pre><code>items = conn.list_order_items(AmazonOrderId = order_id)
result = items.ListOrderItemsResult
</code></pre>

<p>Then I will want to save each item.</p>

<pre><code>for item in result.OrderItems.OrderItem:
    save_item_to_db(item)
</code></pre>

<p>Here the <code>item</code> variable is a type <code>&lt;class 'boto.mws.response.OrderItem'&gt;</code>, which if you print it out shows this:</p>

<blockquote>
  <p>OrderItem{}(Title: u'title',
  GiftWrapPrice: USD 0.00, ConditionNote: u'Brand New&amp; Authentic
  product....', CODFee: None, ASIN: u'XXXX', OrderItemId:
  u'XXXX', CODFeeDiscount: None, QuantityShipped: u'1',
  GiftWrapTax: USD 0.00, ShippingPrice: USD 3.99, QuantityOrdered: u'1',
  ItemTax: USD 0.00, PromotionIds: [], SellerSKU:
  u'XXXX', ShippingDiscount: USD 0.00, ShippingTax: USD
  0.00, ConditionId: u'New', PromotionDiscount: USD 0.00, ItemPrice: USD 12.81, ConditionSubtypeId: u'New')</p>
</blockquote>

<p>why can't I iterate over the key-value pairs like <code>for key in item: print key</code>?  Just a silly though I also tried this: <code>for key in dict(item): print key</code>.  That didn't print anything either.</p>

<p>I would just like to have a more systematic approach for dealing with the <code>item</code> object than visual inspection.  Is it possible to turn it into a normal python dict?</p>