Why got type error :takes 1 position argument but 2 were given?
<p>I have faced a problem with my django project. It is as following:</p>

<p>Get Result: <code>__init__() takes 1 positional argument but 2 were given</code></p>

<p>My code:</p>

<p><strong>urls.py</strong></p>

<pre><code>url(r'^_get_weather', views._get_weather, name='_get_weather')
</code></pre>

<p><strong>views.py</strong></p>

<pre><code>def _get_weather(request):
    r = urllib.request.urlopen('http://api.openweathermap.org/data/2.5/weather?APPID=$API&amp;q=Hongkong')
    s = r.read().decode('utf-8')
    j = json.loads(s)
    temp='Current tempearture: {:.2f}'.format(j['main']['temp'] - 273.15)
    return HttpRequest(temp)
</code></pre>

<p>Your view function should return an <a href="https://docs.djangoproject.com/en/1.10/ref/request-response/#httpresponse-objects"><code>HttpResponse</code></a> not an <a href="https://docs.djangoproject.com/en/1.10/ref/request-response/#httprequest-objects"><code>HttpRequest</code></a>.</p>

python django