Moderation report for Entity Print in Drupal 8

I am reporting https://www.drupal.org/node/2706755 to moderators because:

I am trying to use your slick Entity Print program for programmatically generating and saving PDF files directly to a content type. Do you have a better example? Anyway, here is my persistent error message regardless of the headers that I have tried using:

GuzzleHttpExceptionTooManyRedirectsException: Will not follow more than 5 redirects in GuzzleHttpRedirectMiddleware->guardMax() (line 141 of vendorguzzlehttpguzzlesrcRedirectMiddleware.php).

GuzzleHttpRedirectMiddleware->checkRedirect(Object, Array, Object) (Line: 70)
GuzzleHttpRedirectMiddleware->GuzzleHttp{closure}(Object) (Line: 39)
GuzzleHttpPromiseFulfilledPromise::GuzzleHttpPromise{closure}() (Line: 61)
GuzzleHttpPromiseTaskQueue->run(1) (Line: 246)
GuzzleHttpPromisePromise->invokeWaitFn() (Line: 223)
GuzzleHttpPromisePromise->waitIfPending() (Line: 266)
GuzzleHttpPromisePromise->invokeWaitList() (Line: 225)
GuzzleHttpPromisePromise->waitIfPending() (Line: 62)
GuzzleHttpPromisePromise->wait() (Line: 129)
GuzzleHttpClient->request(‘get’, ‘http://localhost/sunland/entityprint/node/73‘, Array) (Line: 87)
GuzzleHttpClient->__call(‘get’, Array) (Line: 356)
GuzzleHttpClient->get(‘http://localhost/sunland/entityprint/node/73‘, Array) (Line: 356)
Drupalsunland_actionsFormSendMultipleConfirmForm->submitForm(Array, Object)

Here is my code:

        $node = DrupalnodeEntityNode::load($entity->id());

        $dataSource = sprintf("http://localhost/sunland/entityprint/node/%d", $entity->id());
        $dataTarget = sprintf("private://%s-%s", date("Y"), date("m"));
        $dataTitle = sprintf("Released: %s", $entity->label());

        // Create file object from remote URL.
        // Drupal 7: drupal_http_request() is an alternative to file_get_contents()
        // Drupal 8: Drupal::httpClient()->get() is an alternative to drupal_http_request() is an alternative to file_get_contents()
        $response = Drupal::httpClient()->get($dataSource, ['headers' =>
            ['Content-type' => 'application/pdf'],
        ]);

        $data = (string) $response->getBody();
        
        $file = file_save_data($data, $dataTarget);

        // Create node object with attached file.
        $newNode = Node::create([
            'type'        => 'file',  // content type
            'title'       => $dataTitle,
            'field_file' => [
              'target_id' => $file->id(),
            ],
        ]);
        
        $newNode->save();


Source: https://www.drupal.org/project/issues/rss/documentation