def request(self, endpoint, method="<STR_LIT:GET>", data="<STR_LIT>",<EOL>raw=False, params=None, retries=None, client=None,<EOL>headers=None, timeout=None, **kwargs):
retries = self.retries if retries is None else retries<EOL>timeout = self.timeout if timeout is None else timeout<EOL>if client is None:<EOL><INDENT>client = self.setup_oauth_client(endpoint)<EOL>c = client.client<EOL>fnc = OAuth1Session(c.client_key,<EOL>client_secret=c.client_secret,<EOL>resource_owner_key=c.resource_owner_key,<EOL>resource_owner_secret=c.resource_owner_secret<EOL>)<EOL><DEDENT>elif client is False:<EOL><INDENT>fnc = requests<EOL><DEDENT>params = {} if params is None else params<EOL>if data and isinstance(data, dict):<EOL><INDENT>data = json.dumps(data)<EOL><DEDENT>if not raw:<EOL><INDENT>url = self._build_url(endpoint)<EOL><DEDENT>else:<EOL><INDENT>url = endpoint<EOL><DEDENT>headers = headers or {"<STR_LIT:Content-Type>": "<STR_LIT:application/json>"}<EOL>request = {<EOL>"<STR_LIT>": headers,<EOL>"<STR_LIT>": params,<EOL>"<STR_LIT>": timeout,<EOL>}<EOL>request.update(kwargs)<EOL>if method == "<STR_LIT:POST>":<EOL><INDENT>fnc = fnc.post<EOL>request.update({"<STR_LIT:data>": data})<EOL><DEDENT>elif method == "<STR_LIT>":<EOL><INDENT>fnc = fnc.put<EOL>request.update({"<STR_LIT:data>": data})<EOL><DEDENT>elif method == "<STR_LIT:GET>":<EOL><INDENT>fnc = fnc.get<EOL><DEDENT>elif method == "<STR_LIT>":<EOL><INDENT>fnc = fnc.delete<EOL><DEDENT>for attempt in range(<NUM_LIT:1> + retries):<EOL><INDENT>response = self._requester(<EOL>fnc=fnc,<EOL>endpoint=endpoint,<EOL>raw=raw,<EOL>**request<EOL>)<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>return response.json()<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>try:<EOL><INDENT>try:<EOL><INDENT>data = response.json()<EOL>error = data["<STR_LIT:error>"]<EOL><DEDENT>except ValueError:<EOL><INDENT>error = response.content<EOL><DEDENT>if not error:<EOL><INDENT>raise IndexError  <EOL><DEDENT><DEDENT>except IndexError:<EOL><INDENT>error = "<STR_LIT>"<EOL><DEDENT>raise PyPumpException(error)<EOL><DEDENT>if response.ok:<EOL><INDENT>return response<EOL><DEDENT><DEDENT>error = "<STR_LIT>"<EOL>error = error.format(<EOL>url=url,<EOL>data=response.content,<EOL>status=response.status_code<EOL>)<EOL>raise PyPumpException(error)<EOL>
Make request to endpoint with OAuth.
        Returns dictionary with response data.

        :param endpoint: endpoint path, or a fully qualified URL if raw=True.
        :param method: GET (default), POST or DELETE.
        :param data: data to send in the request body.
        :param raw: use endpoint as entered without trying to modify it.
        :param params: dictionary of parameters to send in the query string.
        :param retries: number of times to retry if a request fails.
        :param client: OAuth client data, if False do request without OAuth.
        :param headers: dictionary of HTTP headers.
        :param timeout: the timeout for a request, in seconds.

        Example:
            >>> pump.request('https://e14n.com/api/user/evan/profile', raw=True)
            {u'displayName': u'Evan Prodromou',
             u'favorites': {u'totalItems': 7227,
              u'url': u'https://e14n.com/api/user/evan/favorites'},
             u'id': u'acct:evan@e14n.com',
             u'image': {u'height': 96,
              u'url': u'https://e14n.com/uploads/evan/2014/9/24/knyf1g_thumb.jpg',
              u'width': 96},
             u'liked': False,
             u'location': {u'displayName': u'Montreal, Quebec, Canada',
              u'objectType': u'place'},
             u'objectType': u'person',
             u'preferredUsername': u'evan',
             u'published': u'2013-02-20T15:34:52Z',
             u'summary': u'I wanna make it with you. http://payb.tc/evanp',
             u'updated': u'2014-09-24T02:38:32Z',
             u'url': u'https://e14n.com/evan'}