Code Monkey home page Code Monkey logo

net-twitter's People

Contributors

ammathew avatar arcanez avatar castaway avatar chorny avatar cmlh avatar dandv avatar dsteinbrunner avatar elenis avatar fcuny avatar ghathwar avatar h4ck3rm1k3 avatar haarg avatar hatorikibble avatar jacoby avatar jj avatar jjatria avatar jmacdotorg avatar karenetheridge avatar leto avatar lolytty avatar mgrdcm avatar oalders avatar perigrin avatar pjcj avatar rabcyr avatar sartak avatar semifor avatar skaufman-socialflow avatar spazm avatar zmughal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

net-twitter's Issues

ETA for stable version of 4.x?

Hello, we are using Net::Twitter for some basic search functionality to retrieve tweets into a comment timeline. Our environment is RHEL5/Perl 5.8.8 and we were hoping to create an rpm from the tarball but it's failing with a segmentation fault. (due to its developer status?)

Given that Twitter's cut-off date for v1.0 of the API is March 5th, we were wondering when you expect the stable version to be released and whether an rpm build would be feasible from that version?

Thanks.

proxy support

First of all, thank you very much for maintaining this module and keeping it updated! Any plans to add proxy support to Net::Twitter module? Thank's again!

media_ids parameter should accept a list

According to the spec (https://dev.twitter.com/rest/reference/post/statuses/update), the media_ids parameter of the update() call should take a list of media ID strings as its value.

In current Net::Twitter, if you wish only to attach a single piece of media to a new tweet, then you can set media_ids to that media's value as a string, and it works fine. However, if you try to set media_ids to an ArrayRef of any nonzero length (including one), Net::Twitter seems to interpret this as an attempt to refer to a file on-disk, and therefore usually dies with a no-such-file error.

Consider using JSON::MaybeXS

Would you be open to using JSON::MaybeXS rather than JSON? It appears to be much less buggy and also uses Cpanel::JSON::XS under the hood where possible.

I'm happy to send a pull request.

I came across this because I came across a puzzling error in Net::Twitter::Core::_parse_result() where the JSON parsing was throwing an error. This error goes away with Cpanel::JSON::XS. Since there's no catch block to warn or die it took me a while to track down.

malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before \"\\x{1f}\\x{fffd}\\x{8}\\x{0}...\") at /vagrant/inc/wundercharts-plugin/local/lib/perl5/x86_64-linux-gnu-thread-multi/Moose/Meta/Method/Delegation.pm line 110.\n\tNet::Twitter::Core::from_json(Net::Twitter_v4_01010_with__API_RESTv1_1__OAuth=HASH(0x45738f0), '\\x{1f}\\x{8b}\\x{8}\\x{0}\\x{0}\\x{0}\\x{0}\\x{0}\\x{0}\\x{0}\\x{ec}Wmo\\x{db}6\
\x{10}\\x{fe}+\\x{84}\\x{b6}\\x{e}\\x{1b}\\x{a6}\\x{d8}\\x{d4}\\x{9b}%\\x{b9}(\\x{b6} I;\\x{c}X[\\x{ac})\\x{fa}!\\x{a}\\x{4}Z\\x{a2}l\\x{b6}\\x{12}\\x{a9}
\\x{92}T]/\\x{c8}\\x{7f}\\x{df}Qo\\x{96}\\x{9d}d...')
[truncated stack trace]

Doc Links

It would be super handy if the API methods, like add_place, could link to their actual backend docs, like POST geo/place, most especially because most of the docs in Net::Twitter (and ::Lite) do not document their arguments or return values (what they do or what their type is or whatever.)

Executing Search not ending

Since 23/04 Twitter have problems with some of our programs that search via Net::Twitter.

The problem seems related with issues in Twitter (API Status page https://dev.twitter.com/status)

After investigating we ends with the call to $netTwitter->search never ends and the process start consuming 90-100% CPU.

We though that the problem is that Net::Twitter is performing the search via LWP, we have some experience with LWP and we know that LWP is not managing good timeouts, with some calls that never ends. Looking the code of the component I does not find any control of wrong behaviour of LWP and I think it could be interesting.

We resolve the problem setting a alarm signal to 5s before the function and everything starts to works good.

Code:Modification of a read-only value attempted at Net/Twitter/Core.pm line 233.

Hi,
I'm getting this error
Code:Modification of a read-only value attempted at Net/Twitter/Core.pm line 233.
when I use decode_html_entities

I've tried using it as:

Net::Twitter->new(
		traits          => [qw/API::RESTv1_1 OAuth/],
		consumer_key    => core::Config->get('twitter')->{consumer_key},
		consumer_secret => core::Config->get('twitter')->{consumer_secret},
		ssl             => 1
	);

And:

$result = $self->api->_decode_html_entities($result)

In both cases the same error appears.

I'm using Net::Twitter version 4.01008 and Perl 5.14.2. I've checked the last version of lib and the code from decode_html_entities seems the same to me.

I'm not used with Moo itself and it's grammar but I wonder if the assignment of $_ to another value it's correct or not.

Thanks in advance.

lookup_users does not catch 404 for wrong user ids

If you pass a non-existent user_id to lookup_users, e.g. $twitter->lookup_users({user_id => '123456'}), and there is no valid ID in the request, Net::Twitter will throw a 404 on STDERR and act as if the user did something wrong.

The Twitter API consistently sends a 404 with a 'page not found' message when there's no valid users. This should, in this special case, be catched and processed, returning an empty array, undef or similar, so that scripts relying on probing for info don't have to play catch().

Documentation for send_direct_message unclear

When sending a DM the following response is received (The DM is sent successfully):

user argument to new_direct_message deprecated; use screen_name or user_id at /usr/local/share/perl/5.10.1/Net/Twitter/Role/API/RESTv1_1.pm line 385.

This is via the following line of code:
$nt->new_direct_message( 'target_user', 'This is a test text');

It might be nice if the documentation gave an example of using the screen_name param. I.e.

$nt->new_direct_message( 'This is a test text', { screen_name => 'target_user' } )

Below is the module details i ahve:

M/MM/MMIMS/Net-Twitter-4.01002.tar.gz
/usr/local/share/perl/5.10.1/Net/Twitter.pm
Installed: 4.00006
CPAN: 4.01002 Not up to date
Marc Mims (MMIMS)
[email protected]

show_user issue

After update to 4.00006 (from 3.18) and begin using API::RESTv1_1 the method show_user does not work - the software dies with -
"Sorry, that page does not exist at /usr/lib/perl5/Class/MOP/Method/Wrapped.pm line 162"

Random Error message: "Status is over 140 characters. at twit.pl line 461"

twit.pl is my program. But sometimes Net::Twitter sometimes exists with this error message and just quits. No idea why I'm getting the message as I check the length of all my tweets to make sure they are less than 160 ctrs before they are sent. And I can't debug into Net::Twitter to figure out the error. (If someone knows how to do this please let me know.) Besides I don't know when I'm going to get the error anyway because of the vague error msg.

Can you

  • Print a newline after every error message?
  • Give more details on why this error happens?
  • Put the exact path and filename this error is when it's printed? So if the error is in Net/Twitter.pm the error should read "/usr/local/share/perl/5.18.2/Net/Twitter.pm: Status is over 140 characters..."

trending topics

twitter changed trend api and now the Net::Twitter->trends feature no longer works. returns "This endpoint is deprecated and should no longer be used"

500 Can't connect to API

I have code that I want to use all the time that uses Net::Twitter, but it has been giving me the above error on my Linux box. I adapted the code from the POD:

use feature qw{ state say } ;
use strict ;
use warnings ;
use utf8 ;
use Data::Dumper ;
use Net::Twitter ;
use Scalar::Util 'blessed' ;
my $nt = Net::Twitter->new(
    traits              => [ qw/API::RESTv1_1/ ],
    consumer_key        => 'No' ,
    consumer_secret     => 'No' ,
    access_token        => 'No' ,
    access_token_secret => 'Trust me, I put real values in' ,
    ssl                 => 1
    ) ;
my $result = $nt->update( 'Hello, world! ' . time ) ;
say Dumper $result ; 
exit ;

When I run it on another machine, I get successful tweets. When I run it on the machine I'm behind 8 hours a day, I get:

jacoby@oz:$ dev/t_test.pl
500 Can't connect to api.twitter.com:443 at dev/t_test.pl line 22jacoby@oz:
$

Where line 22 is the one with $nt->update() in it.

It keeps happening to me. I installed perlbrew to get around it, and it worked for a while, then didn't. The error doesn't give me enough information to figure it out myself. Help?

Invalid version format (non-numeric data) at /loader/0x1bed638/App/cpanminus/script.pm line 1134

Yes, I am aware of a previous thread on this.. but upgrading cpanm is not working. I am getting this message on any of the 4.x versions.

root@rectest:/home/cdbs# cpanm --self-upgrade
App::cpanminus is up to date. (1.7001)
root@rectest:/home/cdbs# cpanm --version
cpanm (App::cpanminus) version 1.5007
root@rectest:/home/cdbs# cpanm Net::Twitter
--> Working on Net::Twitter
Fetching http://search.cpan.org/CPAN/authors/id/M/MM/MMIMS/Net-Twitter-4.01004.tar.gz ... OK
Configuring Net-Twitter-4.01004 ... OK
Invalid version format (non-numeric data) at /loader/0x998638/App/cpanminus/script.pm line 1134.

Ubuntu 12.04 64-bit on Digital Ocean

utf-8

Hello, exist Error in Update method and update_with_media the posting Encoding in UTF-8. Receive a reply: Status is over 140 characters.

api v1.1 requires https

twitter now blocks the default settings for the module WithAPIv1_1 version 0.12005

specifically, for $Net::Twitter::Lite::WithAPIv1_1::VERSION = '0.12005'

the following need to default to https rather than http ...

sub _default_api_url               () { 'http://api.twitter.com/1.1'    }
sub _default_searchapiurl          () { 'http://search.twitter.com'     }
sub _default_search_trends_api_url () { 'http://api.twitter.com/1.1'    }
sub _default_lists_api_url         () { 'http://api.twitter.com/1.1'    }

Net::Twitter::Role::OAuth example not working

Hi,

I tried using your example from https://metacpan.org/pod/Net::Twitter::Role::OAuth but the code dies on the get_authorization_url line:

#!/usr/bin/perl

use Net::Twitter;

my $nt = Net::Twitter->new(
    traits          => ['API::RESTv1_1', 'OAuth'],
    consumer_key    => "YOUR-CONSUMER-KEY",
    consumer_secret => "YOUR-CONSUMER-SECRET",
);

# You'll save the token and secret in cookie, config file or session database
my($access_token, $access_token_secret) = restore_tokens();
if ($access_token && $access_token_secret) {
    $nt->access_token($access_token);
    $nt->access_token_secret($access_token_secret);
}

unless ( $nt->authorized ) {
    # The client is not yet authorized: Do it now
    print "Authorize this app at ", $nt->get_authorization_url, " and enter the PIN#\n";

    my $pin = <STDIN>; # wait for input
    chomp $pin;

    my($access_token, $access_token_secret, $user_id, $screen_name) = $nt->request_access_token(verifier => $pin);
    save_tokens($access_token, $access_token_secret); # if necessary
}

sub restore_tokens {
}

sub save_tokens {
    warn join "\n", @_, '';
}

Running this give:

Net::Twitter::Role::OAuth::get_authorization_url(): GET https://api.twitter.com/oauth/request_token failed: 401 Authorization Required at ./tw.pl line 20

Seems to be a recursive error (need to be authorized to get authorized). I did try with my apps keys just so you know.

"Invalid version format (non-numeric data) ..."

I have Perl 5.16.0 installed with perlbrew, and cpanminus v1.5014.

esther:~ gatlinjohnson$ cpanm Net::Twitter
--> Working on Net::Twitter
Fetching http://www.cpan.org/authors/id/M/MM/MMIMS/Net-Twitter-4.00004.tar.gz ... OK
Configuring Net-Twitter-4.00004 ... OK
Invalid version format (non-numeric data) at /loader/0x7f9dcc031238/App/cpanminus/script.pm line 1147.

Mac OS X 10.7.5, MacBook Air if that's useful. I'm sure it's an easy thing, but you might be able to fix it faster than I.

Sending direct messages seems broken

When trying to send a DM via new_direct_message I get the error Sorry, that page does not exist.. According to the twitter docs the API path is now direct_messages/events/new instead of direct_messages/new as stated in the Net::Twitter docs, so I assume the API changed and the module isn't compatible anymore.

Errors from Devel::StackTrace

A process that use Net::Twitter in some scenarios (we setup and alarm to avoid petition last too much) return this error:

panic: attempt to copy freed scalar 3c10e20 to 5895f88 at /usr/local/share/perl/5.14.2/Devel/StackTrace.pm

Looking for seens something related with implementation in Devel::StackTrace

I'm not sure if some workaround could be done in the Net::Twitter::Error component.

some info related with other compoments like Devel::StackTrace

https://rt.perl.org/Public/Bug/Display.html?id=42166
https://rt.perl.org/Public/Bug/Display.html?id=52610
http://www.perlmonks.org/index.pl?node_id=607210

Using perl 5.14.2

Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux

Issue with list_statuses

Hi,

When attempting to get a specific status using:

my $twitterHandle = getTwitterHandle();
my $desiredListId = 4564564;
my $desiredStatuses = $twitterHandle->list_statuses($desiredListId);
exit;

I receive the following error:

Net::Twitter::Role::API::RESTv1_1::list_statuses(): list_statuses expected 0 args at twitterTest.pl line 119

Removing the argument then returns:

You must specify either a list ID or a slug and owner at twitterTest.pl line 119

Checking the documentation (which is at http://search.cpan.org/~mmims/Net-Twitter-4.00005/lib/Net/Twitter/Role/API/RESTv1_1.pm and looks like it is being formatted improperly) I see that this should accept either.

I have never contributed to an OSS or CPAN project before, but if there is any way I can assist with this and attempt to fix the bug, I'd be glad to help.

t/10_net-twitter-regression.t and t/12_identica.t fail (with newest JSON::XS?)

My smoker machines report a new failure:

#   Failed test 'relationship_exists scalar args'
#   at t/10_net-twitter-regression.t line 43.
#          got: '200 OK at t/10_net-twitter-regression.t line 43'
#     expected: undef
200 OK at t/10_net-twitter-regression.t line 45# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 2 just after 5.
t/10_net-twitter-regression.t ..
Dubious, test returned 2 (wstat 512, 0x200)
Failed 1/5 subtests
...
200 OK at t/12_identica.t line 21# Looks like you planned 5 tests but ran 1.
# Looks like your test exited with 2 just after 1.
t/12_identica.t ................
Dubious, test returned 2 (wstat 512, 0x200)
Failed 4/5 subtests

It seems that the problem is caused by JSON-XS-3.02.

warnings with Moose 2.2004

The latest Moose now contains more checks for overwriting internal methods, and now Net::Twitter warns...

(newlines added for readability)

perl -MNet::Twitter -wle'print Net::Twitter->new(traits => ["API::RESTv1_1", "OAuth"], consumer_key => 123, consumer_secret => 456, ssl => 1)'
You are overwriting a accessor (request_token_url) for the request_token_url attribute
(defined at .../Net/Twitter/Role/OAuth.pm line 43) with a new reader method for the
request_token_url attribute (defined at .../Net/Twitter/Role/OAuth.pm line 43) at
.../Moose/Meta/Attribute.pm line 1096, <DATA> line 1.

include_email for api 1.1

ref: https://dev.twitter.com/rest/reference/get/account/verify_credentials
there is an include_email flag that can be set for verify_credentials now.

just needs adding to RESTv1_1.pm

twitter_api_method verify_credentials => (
description => <<'',
Returns an HTTP 200 OK response code and a representation of the
requesting user if authentication was successful; returns a 401 status
code and an error message if not. Use this method to test if supplied
user credentials are valid.

path     => 'account/verify_credentials',
method   => 'GET',
params   => [qw/include_entities skip_status include_email/],
booleans => [qw/include_entities skip_status include_email/],
required => [qw//],
returns  => 'ExtendedUser',

);

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.