def raw_api_call(self, url, parameters={}, http_method="GET", max_timeout=4):
        """
        Make an API Call to GitHub
        """
        # limit to 1 call per 1.15 seconds
        if time.time() - self._fetched <= 1.15:
            time.sleep(1.15 - (time.time() - self._fetched))
        self._fetched = time.time()
        
        sock = httplib2.Http(timeout=max_timeout)
        
        request_headers = { 'User-Agent': 'Python-httplib2' }
        
        parameters.update({ 'username': self.username,
                            'token': self.token })
        
        if http_method == 'POST':
            post_data = urlencode(parameters)
        elif parameters:
            url += '?%s' % urlencode(parameters)

        try:
            if http_method == 'POST':
                headers, response = sock.request(url, "POST", post_data, headers=request_headers)
            else:
                headers, response = sock.request(url)
        except socket.timeout:
            raise ValueError('Socket timed out')
                
        status = int(headers.pop('status', 200))
        if status != 200:
            raise ValueError('Returned status: %s' % (status))
        
        try:
            processed_response = simplejson.loads(response)
        except __HOLE__, e:
            raise ValueError('Error in data from GitHub API: %s' % e.message)
    
        return processed_response
dataset/ETHPy150Open frozenskys/django-github/github/libs/github.py/GithubAPI.raw_api_call