MDL-69006 repository_flickr: flickr authentication fails

- Flickr does not like useragents including the word "Bot"
This commit is contained in:
Bas Brands
2020-06-10 15:08:41 +02:00
parent 71a34a039f
commit b8ee31a0ce
2 changed files with 9 additions and 1 deletions
+4
View File
@@ -60,12 +60,16 @@ class flickr_client extends oauth_helper {
* @param moodle_url|string $callbackurl
*/
public function __construct($consumerkey, $consumersecret, $callbackurl = '') {
global $CFG;
$version = moodle_major_version();
$useragent = "MoodleSite/$version (+{$CFG->wwwroot})";
parent::__construct([
'api_root' => self::OAUTH_ROOT,
'oauth_consumer_key' => $consumerkey,
'oauth_consumer_secret' => $consumersecret,
'oauth_callback' => $callbackurl,
'http_options' => ['CURLOPT_USERAGENT' => $useragent]
]);
}
+5 -1
View File
@@ -108,7 +108,11 @@ class oauth_helper {
$this->access_token_secret = $args['access_token_secret'];
}
$this->http = new curl(array('debug'=>false));
$this->http_options = array();
if (!empty($args['http_options'])) {
$this->http_options = $args['http_options'];
} else {
$this->http_options = array();
}
}
/**