Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possibility to set custom curl options #164

Merged
merged 1 commit into from
Sep 13, 2016
Merged

Conversation

gitazem
Copy link
Contributor

@gitazem gitazem commented Sep 8, 2016

sometimes need to set some useful curl options. example:

$customCurlOptions = ['CURLOPT_TIMEOUT' => 1];

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@gitazem
Copy link
Contributor Author

gitazem commented Sep 8, 2016

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@fiboknacky
Copy link
Member

Hi @gitazem

Thanks so much for your pull request.
Could you please clarify in what situations you would like to set extra cURL options for downloading reports?

Best,
Knack

@gitazem
Copy link
Contributor Author

gitazem commented Sep 9, 2016

Hello,

I am downloading many reports each day, and sometimes wsdl called via curl takes too long to respond. When i will set a smaller timeout, i can retry request faster. So all my download runs faster. Thank you !

Best,
Gita

On 09 Sep 2016, at 04:43, Thanet Praneenararat [email protected] wrote:

Hi @gitazem https://github.com/gitazem
Thanks so much for your pull request.
Could you please clarify in what situations you would like to set extra cURL options for downloading reports?

Best,
Knack


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #164 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AHV7FMd11Vi1749-mkXctT7VVAcPMPO7ks5qoLnWgaJpZM4J4bSp.

@fiboknacky
Copy link
Member

Hello Gita,

But AdWords API reporting isn't involved with WSDL and SOAP calls, I believe.
So you benefit from this curl options for normal HTTP requests?

Best,
Knack

@gitazem
Copy link
Contributor Author

gitazem commented Sep 9, 2016

Hello,

yes, sorry, you are right. Its needed for normal HTTP requests.

Best,
Gita

On 09 Sep 2016, at 07:30, Thanet Praneenararat [email protected] wrote:

Hello Gita,

But AdWords API reporting isn't involved with WSDL and SOAP calls, I believe.
So you benefit from this curl options for normal HTTP requests?

Best,
Knack


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #164 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AHV7FH8aghVfzLoZP7teJdudBopI8bhsks5qoOD0gaJpZM4J4bSp.

@fiboknacky fiboknacky merged commit d953608 into googleads:master Sep 13, 2016
@hakimio
Copy link

hakimio commented Oct 4, 2016

@fiboknacky Can we also have this in experimental branch?

@fiboknacky
Copy link
Member

Hi @hakimio,

In the experimental branch, we use Guzzle for downloading reports.
You can set your custom cURL options by following this section.

Best,
Knack

@hakimio
Copy link

hakimio commented Oct 6, 2016

@fiboknacky
Are you suggesting that I make a pull request with changes for experimental branch like Gita did for master? Or is there already a simple way to get guzzle client instance and set cURL options? I just want to set timeout options like Gita did before calling downloadReport().

@fiboknacky
Copy link
Member

Hi @hakimio,

I think the support for setting custom cURL options is already supported via construction of Client object.

More specifically, you can create a Guzzle Client by passing an array containing your curl options as its first parameter.

Then, you specify this object as a parameter of ReportDownloader.
Based on the documentation of Guzzle and from its code, this should work.
Please let me know if it doesn't.

So, probably we don't need to modify our code in the experimental branch.

Cheers,
Knack

@hakimio
Copy link

hakimio commented Oct 6, 2016

I can see that you are setting "handler" Guzzle Client config in ReportDownloader constructor when instantiating the client. Wouldn't it make more sense to accept guzzle client config (array) instead of client instance as the constructor parameter and then merge custom config with the default options?

@fiboknacky
Copy link
Member

Hi @hakimio,

That is another possible way to do.
But Guzzle opens room for many more configurations, not only request options.
For instance, you can inject the middleware and handlers via this Client already.

Curl options are another kind of configs that can be treated in the same way--passing as parameter to Client constructor, so I don't see the point why we want to bloat the signature of ReportDownloader by creating another parameter (which can be combined into the Client object itself) and then merge those configs with AdWords API default options by ourselves (which is actually handled by Guzzle for every request).

Best,
Knack

@hakimio
Copy link

hakimio commented Oct 6, 2016

I see. Thanks for explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants