diff --git a/src/SuperPREDTargetPrediction.php b/src/SuperPREDTargetPrediction.php index 92b873f..055f1eb 100644 --- a/src/SuperPREDTargetPrediction.php +++ b/src/SuperPREDTargetPrediction.php @@ -25,9 +25,12 @@ class SuperPREDTargetPrediction private string $userAgent = ''; private string $SMILES_code = ''; - public function __construct() + private int $requestTimeout; + + public function __construct(int $requestTimeout = 20) { - $this->userAgent = $this->userAgentsPool[rand(0, count($this->userAgentsPool) - 1)]; + $this->requestTimeout = $requestTimeout; + $this->userAgent = $this->userAgentsPool[rand(0, count($this->userAgentsPool) - 1)]; } public function setUserAgent(string $ua): SuperPREDTargetPrediction @@ -131,7 +134,7 @@ public function getRawTargets(): array private function doPostCall(string $url, array $post_data): ResponseInterface { $client = new Client([ - 'timeout' => 20, + 'timeout' => $this->requestTimeout, ]); return $client->request('POST', $url, [