Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Net::Twitter::Lite::WithAPIv1_1 bad request

by xavandar (Initiate)
on Apr 17, 2017 at 09:52 UTC ( #1188113=perlquestion: print w/replies, xml ) Need Help??

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

i try to post hello world and all time :
C:\a>perl Net::Twitter::Lite::WithAPIv1_1=HASH(0x31ec738) 400: Bad Request C:\a> use Net::Twitter::Lite::WithAPIv1_1; use Scalar::Util 'blessed'; # use strict; # When no authentication is required: #my $nt = Net::Twitter->new(legacy => 0); # As of 13-Aug-2010, Twitter requires OAuth for authenticated reques +ts my $nt = Net::Twitter::Lite::WithAPIv1_1->new( traits => [qw/API::RESTv1_1/], consumer_key => "xxxxxxxxxxxxxxxx", consumer_secret => "xxxxxxxxxxxxxxx", oauth_token => "xxxxxxxxx", oauth_token_secret => "xxxxxxxxxxx", ssl =>1, apiurl => '' ); print "\n"; print $nt."\n"; eval { my $result = $nt->update('Hello, world! from perl')}; #my $result = $nt->update =>({status =>'Hello, world from perl and n +et:twitter!'}); #print $result."dansleprint\n"; if ( my $err = $@ ) { die $@ unless blessed $err && $err->isa('Net::Twitter::Error'); warn "HTTP Response Code: ", $err->code, "\n", "HTTP Message......: ", $err->message, "\n", "Twitter error.....: ", $err->error, "\n"; }

Replies are listed 'Best First'.
Re: Net::Twitter::Lite::WithAPIv1_1 bad request
by marto (Cardinal) on Apr 17, 2017 at 09:57 UTC
    apiurl => ''

    "Sorry, that page doesn’t exist!", so that's wrong. I don't have an apiurl in my working config:

    my $twitter = Net::Twitter::Lite::WithAPIv1_1->new( access_token_secret => $config->{TWITTER_ACCESS_SECRET}, consumer_secret => $config->{TWITTER_CONSUMER_SECRET}, access_token => $config->{TWITTER_ACCESS_TOKEN}, consumer_key => $config->{TWITTER_CONSUMER_KEY}, user_agent => 'TwitterBotExample', ssl => 1, );

    Update my code was based on this short tutorial.

    Update: fixed link.

Re: Net::Twitter::Lite::WithAPIv1_1 bad request
by Mr. Muskrat (Canon) on Apr 19, 2017 at 14:12 UTC

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1188113]
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-06-28 00:28 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (89 votes). Check out past polls.