Git Product home page Git Product logo

Comments (4)

stealthylabs avatar stealthylabs commented on June 13, 2024

seems like something is off with my code as I was using Mojo::UserAgent and I need to use LWP::UserAgent to make it work as in your example.

from amazon-paapi5-signature.

bayashi avatar bayashi commented on June 13, 2024

@stealthylabs Hello. Thank you for using. Yeah, could you please try this script first? Then, try with your actual code. I'm not sure Mojo::UserAgent well though. It'd be able to work with, I guess. I'm looking forward a successful report. 👍

from amazon-paapi5-signature.

stealthylabs avatar stealthylabs commented on June 13, 2024

@bayashi that script worked fine and your script also worked fine. and in my script I used LWP::UserAgent, used 1 ASIN and it worked fine if the following print was not done before the request. Then you get the 401 error. So it seems that by calling print I am somehow changing the signature of the $sig object and that gives the 401 error below.

    my $sig = Amazon::PAApi5::Signature->new(
        $ACCESS_KEY,
        $SECRET_KEY,
        $payload,
        {
            operation => 'GetItems',
            host      => 'webservices.amazon.com',
            region    => 'us-east-1',
        },
    );
    print Dumper($sig->req_url), "\n";
    print Dumper($sig->headers), "\n";
    print $sig->payload, "\n";

    my $ua = LWP::UserAgent->new;

    my $req = POST $sig->req_url, $sig->headers, Content => $sig->payload;
    my $res = $ua->request($req);

    warn Dumper($res->status_line, $res->content);
`VAR1 = '401 Unauthorized';
$VAR2 = '{"__type":"com.amazon.paapi5#InvalidSignatureException","Errors":[{"Code":"InvalidSignature","Message":"The request has not been correctly signed. If you are using an AWS SDK, requests are signed for you automatically; otherwise, go to https://webservices.amazon.com/paapi5/documentation/sending-request.html#signing."}]}';
`



from amazon-paapi5-signature.

bayashi avatar bayashi commented on June 13, 2024

hm, I can't see a reason why you got 401 from the part of code. Anyway, it's okay to work. Thank you.

from amazon-paapi5-signature.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.