Discussion:
Mojolicious not completing large requests from Google Contacts API
(too old to reply)
Steve Dondley
2018-09-12 21:57:43 UTC
Permalink
I'm using Google's Contact API to download all my contacts. There are
probably several thousand contacts. I'm using the Google::Moo
<https://metacpan.org/pod/Moo::Google> perl module which uses the
Mojolicious user agent.

I can successfully download up to about 200 contacts with one shot but
after that, I get a response with no content even though the response code
is "200." I set the $ENV variable to lift max_line_size, max_buffer_size,
etc. but it did not work.

The limitation is not on Google's side as I can successfully get all
contacts via their web based Oauth 2.0 playground service.

Any ideas on what I can try to coerce Mojolicious to get the content of the
api call with a large response?
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Steve Dondley
2018-09-12 22:06:59 UTC
Permalink
So I took a closer look at the response object returned. Looks like for
smaller queries the response is stored in memory and for larger queries the
response is stuffed into a temporary file, as far as I can tell. How do I
get access to this file and where is it?
Post by Steve Dondley
I'm using Google's Contact API to download all my contacts. There are
probably several thousand contacts. I'm using the Google::Moo
<https://metacpan.org/pod/Moo::Google> perl module which uses the
Mojolicious user agent.
I can successfully download up to about 200 contacts with one shot but
after that, I get a response with no content even though the response code
is "200." I set the $ENV variable to lift max_line_size, max_buffer_size,
etc. but it did not work.
The limitation is not on Google's side as I can successfully get all
contacts via their web based Oauth 2.0 playground service.
Any ideas on what I can try to coerce Mojolicious to get the content of
the api call with a large response?
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Dan Book
2018-09-12 22:16:59 UTC
Permalink
There should be no visible difference if you are retrieving the content
with methods like ->body ->text or ->json.

-Dan
Post by Steve Dondley
So I took a closer look at the response object returned. Looks like for
smaller queries the response is stored in memory and for larger queries the
response is stuffed into a temporary file, as far as I can tell. How do I
get access to this file and where is it?
Post by Steve Dondley
I'm using Google's Contact API to download all my contacts. There are
probably several thousand contacts. I'm using the Google::Moo
<https://metacpan.org/pod/Moo::Google> perl module which uses the
Mojolicious user agent.
I can successfully download up to about 200 contacts with one shot but
after that, I get a response with no content even though the response code
is "200." I set the $ENV variable to lift max_line_size, max_buffer_size,
etc. but it did not work.
The limitation is not on Google's side as I can successfully get all
contacts via their web based Oauth 2.0 playground service.
Any ideas on what I can try to coerce Mojolicious to get the content of
the api call with a large response?
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Steve Dondley
2018-09-12 22:20:59 UTC
Permalink
I was able to retrieve the content with $res->content->asset->slurp;

I'm not familiar with how to get a json response with the Contacts API.
Will have to research. Thanks for the tip.
Post by Dan Book
There should be no visible difference if you are retrieving the content
with methods like ->body ->text or ->json.
-Dan
Post by Steve Dondley
So I took a closer look at the response object returned. Looks like for
smaller queries the response is stored in memory and for larger queries the
response is stuffed into a temporary file, as far as I can tell. How do I
get access to this file and where is it?
Post by Steve Dondley
I'm using Google's Contact API to download all my contacts. There are
probably several thousand contacts. I'm using the Google::Moo
<https://metacpan.org/pod/Moo::Google> perl module which uses the
Mojolicious user agent.
I can successfully download up to about 200 contacts with one shot but
after that, I get a response with no content even though the response code
is "200." I set the $ENV variable to lift max_line_size, max_buffer_size,
etc. but it did not work.
The limitation is not on Google's side as I can successfully get all
contacts via their web based Oauth 2.0 playground service.
Any ideas on what I can try to coerce Mojolicious to get the content of
the api call with a large response?
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Steve Dondley
2018-09-12 22:27:00 UTC
Permalink
OK, yup, full response comes through with json. Nice. For anyone
experiencing the same thing, do something like this:


my $res = Moo::Google->new()->api_query( {
httpMethod => 'get',
path =>
'https://www.google.com/m8/feeds/contacts/default/full?v=3.0&start-index=1&max-results=50000&alt=json',
});


https://www.google.com/m8/feeds/contacts/default/full?v=3.0&start-index=$start_index&max-results=50
Post by Steve Dondley
I was able to retrieve the content with $res->content->asset->slurp;
I'm not familiar with how to get a json response with the Contacts API.
Will have to research. Thanks for the tip.
Post by Dan Book
There should be no visible difference if you are retrieving the content
with methods like ->body ->text or ->json.
-Dan
Post by Steve Dondley
So I took a closer look at the response object returned. Looks like for
smaller queries the response is stored in memory and for larger queries the
response is stuffed into a temporary file, as far as I can tell. How do I
get access to this file and where is it?
Post by Steve Dondley
I'm using Google's Contact API to download all my contacts. There are
probably several thousand contacts. I'm using the Google::Moo
<https://metacpan.org/pod/Moo::Google> perl module which uses the
Mojolicious user agent.
I can successfully download up to about 200 contacts with one shot but
after that, I get a response with no content even though the response code
is "200." I set the $ENV variable to lift max_line_size, max_buffer_size,
etc. but it did not work.
The limitation is not on Google's side as I can successfully get all
contacts via their web based Oauth 2.0 playground service.
Any ideas on what I can try to coerce Mojolicious to get the content of
the api call with a large response?
--
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Dan Book
2018-09-12 22:32:44 UTC
Permalink
For future reference, ->body is exactly equivalent to
->content->asset->slurp, except that it also handles multipart bodies.

-Dan
Post by Steve Dondley
I was able to retrieve the content with $res->content->asset->slurp;
I'm not familiar with how to get a json response with the Contacts API.
Will have to research. Thanks for the tip.
Post by Dan Book
There should be no visible difference if you are retrieving the content
with methods like ->body ->text or ->json.
-Dan
Post by Steve Dondley
So I took a closer look at the response object returned. Looks like for
smaller queries the response is stored in memory and for larger queries the
response is stuffed into a temporary file, as far as I can tell. How do I
get access to this file and where is it?
Post by Steve Dondley
I'm using Google's Contact API to download all my contacts. There are
probably several thousand contacts. I'm using the Google::Moo
<https://metacpan.org/pod/Moo::Google> perl module which uses the
Mojolicious user agent.
I can successfully download up to about 200 contacts with one shot but
after that, I get a response with no content even though the response code
is "200." I set the $ENV variable to lift max_line_size, max_buffer_size,
etc. but it did not work.
The limitation is not on Google's side as I can successfully get all
contacts via their web based Oauth 2.0 playground service.
Any ideas on what I can try to coerce Mojolicious to get the content of
the api call with a large response?
--
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Loading...