Goutte / Guzzle setDefaultOption()方法无效

时间:2015-11-16 00:26:06

标签: symfony goutte

def main():
    tests = get_initial_input("tests")
    assignments = get_initial_input("assignments")
    exercises = get_initial_input("exercises")
    labs = get_initial_input("labs")
    finals = get_initial_input("finals")
    testsp = get_scores(tests)
    assignmentsp = get_scores(assignments)
    exercisesp = get_scores(exercises)
    labsp = get_scores(labs)
    finalsp = get_scores(finals)
def get_initial_input(x):
    val = int(input("How many "+ x + " were there?    "))
    return val

def get_scores(x):
    if x > 0:
            xp = int(input("What percentage are "+ str(x) + " weighted?"))
            return xp

main()

给出错误“在类GuzzleHttp / Client中找不到方法setDefaultOption” 代码完成也找不到方法。 示例来自https://github.com/FriendsOfPHP/Goutte

我确实在Guzzle~6上,所以这段代码有效:

use Goutte\Client;

/**
 * code removed
 */
class  ......... {

  public function xxxxxx() {

    $client = new Client();
    $client->getClient()->setDefaultOption('config/curl/'.CURLOPT_TIMEOUT, 60);

0 个答案:

没有答案