Python code to do GET request from pipedrive API
<p>I am using python-pipedrive to wrap Pipedrive's API though it doesn't quite work out of the box on python3 (which I'm using) so I modified it. I'm having trouble with just the Http requests portion.</p>

<p>This is what taught me how to use Httplib2: <a href="https://github.com/jcgregorio/httplib2/wiki/Examples-Python3" rel="nofollow">https://github.com/jcgregorio/httplib2/wiki/Examples-Python3</a></p>

<p>Basically, I just want to send a GET request to this:
<a href="https://api.pipedrive.com/v1/persons/123?api_token=1234abcd1234abcd" rel="nofollow">https://api.pipedrive.com/v1/persons/123?api_token=1234abcd1234abcd</a></p>

<p>This works:</p>

<pre><code>from httplib2 import Http
from urllib.parse import urlencode

PIPEDRIVE_API_URL = "https://api.pipedrive.com/v1/persons/123?api_token=1234abcd1234abcd"

response, data = http.request(PIPEDRIVE_API_URL, method='GET', 
    headers={'Content-Type': 'application/x-www-form-urlencoded'})
</code></pre>

<p>However, Pipedrive returns an error 401 with 'You need to be authorized to make this request.' if I do this:</p>

<pre><code>PIPEDRIVE_API_URL = "https://api.pipedrive.com/v1/"
parameters = 'persons/123'
api_token = '1234abcd1234abcd'

response, data = http.request(PIPEDRIVE_API_URL + parameters, 
    method='GET', body=urlencode(api_token), 
    headers={'Content-Type': 'application/x-www-form-urlencoded'})
</code></pre>

<p>The actual response is:</p>

<pre><code>response =    
{'server': 'nginx', 
'status': '401', 
'connection': 'keep-alive', 
'set-cookie': 'pipe-session=7b6ddadbc67abdadb6a67dbadcb; path=/; domain=.pipedrive.com; secure; httponly', 
'date': 'Sat, 11 Jun 2016 06:50:13 GMT', 
'transfer-encoding': 'chunked', 
'x-frame-options': 'SAMEORIGIN', 
'content-type': 'application/json, charset=UTF-8', 
'x-xss-protection': '1; mode=block'}

data = 
{'success': False, 
'error': 'You need to be authorized to make this request.'}
</code></pre>

<p>How do I properly provide the api_token as a parameter (body) to the GET request? Anyone know what I'm doing wrong?</p>