title: AttributeError: 'NoneType' object has no attribute 'get' while on loop
body: <p>I know this is an attribute error that is caused because of trying to access a property that is not defined on the </p>
  
  <p>So basically I am parsing a JSON response returned by an API.</p>
  
  <p>the response looks like this.</p>
  
  <pre><code>{
      "someProperty": {
           "value": 123
       }
  },
  {
      "someProperty":null
  },
  </code></pre>
  
  <p>which I am looping the <code>x = response.json()</code> object and trying to access as,</p>
  
  <pre><code>x.get('someProperty', {}).pop('value', 0)
  </code></pre>
  
  <p>which works on the testing with the interpreter manually</p>
  
  <pre><code>In[2]: x = {1:2, 2:34}
  In[3]: x.get('someProperty', {}).pop('value', 0)
  Out[3]: 0
  </code></pre>
  
  <p>but when accessed the same inside a class function, it raises attribute error. What am I doing wrong?</p>
  
  <p><strong>The error is only raised when the method is called progmatically when the value of <code>someProperty</code> is null.</strong></p>
  
  <h2>update</h2>
  
  <p>it is how I am using inside a class.</p>
  
  <pre><code>class SomeClass(object):
  
      def __init__(self, **kwargs):
          self.value = kwargs.get('someProperty', {}).pop('value', 0)
  
      def save():
          pass
  </code></pre>
  
  <p>Now the usage,</p>
  
  <pre><code>x = response.json()
  for num, i in enumerate(x):
      j = SomeClass(**i)
      j.save()
  </code></pre>