Skip to content

Commit 779edf0

Browse files
committed
rewrite clients http
1 parent d03276e commit 779edf0

File tree

4 files changed

+293
-241
lines changed

4 files changed

+293
-241
lines changed

app/src/Commands/FeedImporter.php

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use League\CLImate\CLImate;
88
use DB;
99
use Lerama\Services\FeedTypeDetector;
10+
use Lerama\Config\HttpClientConfig;
1011
use GuzzleHttp\Client;
1112

1213
class FeedImporter
@@ -19,27 +20,7 @@ public function __construct(CLImate $climate)
1920
{
2021
$this->climate = $climate;
2122
$this->feedDetector = new FeedTypeDetector();
22-
$this->httpClient = new Client([
23-
'timeout' => 15,
24-
'connect_timeout' => 10,
25-
'http_errors' => false,
26-
'allow_redirects' => [
27-
'max' => 5,
28-
'strict' => false,
29-
'referer' => true,
30-
'protocols' => ['http', 'https'],
31-
'track_redirects' => false
32-
],
33-
'headers' => [
34-
'User-Agent' => 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/W.X.Y.Z Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
35-
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
36-
'Accept-Language' => 'en-US,en;q=0.5',
37-
'Accept-Encoding' => 'gzip, deflate',
38-
'Cache-Control' => 'no-cache'
39-
],
40-
'verify' => true,
41-
'decode_content' => 'gzip'
42-
]);
23+
$this->httpClient = new Client(HttpClientConfig::getDefaultConfig());
4324
}
4425

4526
public function import(string $csvPath): void

0 commit comments

Comments
 (0)