Override the Client.php timeout settings for curl

Issue #24 closed
Former User created an issue

How can I override the Client.php option timeout in the Http/Client.php curl call without altering the class.? It could be doable when creating the bitbucket object

I want to set to 0 so it does not timeout retrieving large numbers tags from a repo.

    protected $options = array(
        'base_url'      => 'https://api.bitbucket.org',
        'api_version'   => '1.0',
        'api_versions'  => array('1.0', '2.0'),     // supported versions
        'format'        => 'json',
        'formats'       => array('json', 'xml'),    // supported response formats
        'user_agent'    => 'bitbucket-api-php/0.6.0 (https://bitbucket.org/gentlero/bitbucket-api)',
        'timeout'       => 10,
        'verify_peer'   => false
    );

Comments (3)

  1. Alexandru Guzinschi

    You can set a new client with setClient() method from any class.

    Example:

    $repository = new \Bitbucket\API\Repositories\Repository();
    
    $repository->setClient(
        new \Bitbucket\API\Http\Client(array('timeout' => 0));
    );
    
  2. Former User reporter

    Hi thanks for the quick response - I new there was something that could be done a good lesson in OO.

    remove ;

    $repository->setClient(
        new \Bitbucket\API\Http\Client(array('timeout' => 0))
    );
    
  3. Log in to comment