How to fix too much time taken by python requests during get and post?

129 Views Asked by At

There is one website written in CakePhp and I am moving to Django. Some pages are making get/post request to another website to collect some information.

CakePhp

$start = time();
$socket = new HttpSocket();
$api_ret = $socket->get($url,$data,$this->header);
$end = time();
CakeLog::write('Time', print_r($end-$start,true));

Django

import requests
from datetime import datetime
start = datetime.now()
api_ret = requests.get(url,data,headers=self.header)
end = datetime.now()
print((end-start).total_seconds())

Time taken by requests is too long compare to CakePhp.

Is there anything I am doing wrong or Is there any other library that I can use ? Please Help.

0

There are 0 best solutions below