Comments (4)
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.
@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.
@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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-paapi5-signature.