Questions tagged [mojo-useragent]

Mojo::UserAgent is an HTTP client for Perl included with the Mojolicious web framework.

26 questions
1
vote
1 answer

why is the hash value missing in the below code

I wanted to do a POST request to jira and jfrog. while I try to get the values of the hash within the loop am not able to get the value the second time. I try to read the variable(API token instead of password) from env, if not set it will pass the…
Itsme
  • 59
  • 6
1
vote
1 answer

POST request to JIRA REST API to create issue of type Minutes

my $create_issue_json = '{"fields": { "project": { "key": "ABC" }, "summary": "summary for version 1", "description": "Creating an issue via REST API", "issuetype": { "name": "Minutes" }}}'; $tx1 = $jira_ua->post($url2 => json =>…
Itsme
  • 59
  • 6
1
vote
1 answer

Decoding result with Mojo::UserAgent for regex match

I'm trying to work out why this won't work: my $url = 'www880740.com'; use Mojo::UserAgent; my $ua = Mojo::UserAgent->new->max_redirects(3); $ua->transactor->name( "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9; Gecko/2008052906 Firefox/3.0"…
Andrew Newby
  • 4,941
  • 6
  • 40
  • 81
1
vote
1 answer

Capture both resolved and rejected in Perl's Mojo::Promises

I'm playing with Mojo::UserAgent and Mojo::Promise to run non-blocking calls to 3 services A, B, and C. The problem is it works fine when all the services connect/resolve, but if one of those, say, service C is unable to connect, the whole thing…
santa100
  • 255
  • 1
  • 5
1
vote
1 answer

Mojo::DOM and Text Method to remove spaces

I have the following code which using Mojo::DOM to get the text my $text =ua->get('https://my_site.org'.$_)->res->dom->at('div.container-fluid h1')->text; while the text under h1 if on the following format :

my_text …

jsor
  • 97
  • 5
1
vote
2 answers

HTTP::Cookies to Mojo::UserAgent::CookieJar

I have $cookie_jar which created using HTTP::Cookies: $cookie_jar = HTTP::Cookies->new( file => "my$path/my_cookies.dat", autosave => 1, ); I want to use this $cookie_jar using Mojo::UserAgent but didn't find an option, the only option I see is…
jsor
  • 97
  • 5
1
vote
1 answer

Mojo::UserAgent and local_address method

I am new to Mojo::UserAgent (https://metacpan.org/pod/Mojo::UserAgent) , I am trying to explore its functions. I found this function on the docs : local_address my $address = $ua->local_address; $ua = $ua->local_address('127.0.0.1'); Local…
jsor
  • 97
  • 5
0
votes
2 answers

Mojo::UserAgent response and pretty JSON

I have the following code which using Mojo::UserAgent to get a json response: $tx = $ua->get($host.'/api/endpoint/streams' => {Token => $token , accept => 'application/json' ,'Content-Type' => 'application/json' }); print $tx->res->body; which…
dave
  • 867
  • 1
  • 5
  • 11
0
votes
1 answer

Mojo::useragent SSL failure

i am using Mojo::Useragent to fetch some site behind a proxy which defined using HTTP_PROXY and HTTPS_PROXY below an example of the code : my $rs = $ua->insecure(1)->get($mysite) if($rs->res->is_success) { ..... } else { print "Problem with…
jsor
  • 637
  • 4
  • 10
0
votes
1 answer

Mojo::UserAgent non-blocking vs blocking performance

I have the following code: my $ua = Mojo::UserAgent->new (); my @ids = qw(id1 id2 id3); foreach (@ids) { my $input = $_; my $res = $ua->get('http://my_site/rest/id/'.$input.'.json' => sub { my ($ua, $res) = @_; print…
jsor
  • 637
  • 4
  • 10
0
votes
1 answer

"Use of uninitialized value $_" warning with a Mojo::UserAgent non-blocking request

I am trying to make a non-blocking request with Mojo::UserAgent but when I run the code below I get Use of uninitialized value $_ in concatenation (.) or string on the print line. How can I access $_ inside the callback? my $ua =…
jsor
  • 637
  • 4
  • 10
1
2