http://qs321.pair.com?node_id=11137003

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

Is there an equivalent of the "request" Python module in Perl? The only similar module I see is Rest:: Client, but it hasn't been updated since 2015.

  • Comment on Perl equivalent for Python's request module for REST APIs.

Replies are listed 'Best First'.
Re: Perl equivalent for Python's request module for REST APIs.
by hippo (Bishop) on Sep 25, 2021 at 08:46 UTC
    The only similar module I see is Rest:: Client, but it hasn't been updated since 2015.

    REST::Client is a module for making requests to REST API servers. It is stable and solid which is why it has not needed any recent updates.


    🦛

Re: Perl equivalent for Python's request module for REST APIs.
by Fletch (Bishop) on Sep 24, 2021 at 23:40 UTC

    Prossibly not exactly what you're looking for but the Mojolicious web framework comes with a pretty spiffy set of client functionality. Look at Mojo::UserAgent (and the mojo docs) and see if that might scratch your itch.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: Perl equivalent for Python's request module for REST APIs.
by LanX (Saint) on Sep 25, 2021 at 01:30 UTC

      ... or HTTP::Tiny, which has been in core since 5.13.9. Of course, if you are using one of those *nix systems where the downstream packagers know better than p5p what ought to be in core, you may still not have it.

        Wow, thanks for mentioning that! I had never noticed it was in the core.

        return on_success() or die;

      I agree.

      Although the TIMTOWTDI principle applies here as in almost everything regarding Perl, I'd say most of the times you want to interact with the Web in Perl, you'd go with LWP.

      return on_success() or die;