Skip Menu |

This queue is for tickets about the WWW-Pastebin-PastebinCom-Create CPAN distribution.

Report information
The Basics
Id: 81288
Status: resolved
Priority: 0/
Queue: WWW-Pastebin-PastebinCom-Create

People
Owner: Nobody in particular
Requestors: ofosos [...] googlemail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.004
Fixed in: (no value)



Subject: Paste reports disabled API
Hi, I'm having a problem pasting stuff. I get a $paste that says: "THIS API HAS BEEN DISABLED. Please use Pastebin's new API. http://pastebin.com/api" I attached a patch, this requires an additional api_dev_key. If you're fine with the patch functionality wise, I'd like to attach a second patch to fix the documentation. Regards, Mark
Subject: ofosos.txt
--- WWW-Pastebin-PastebinCom-Create-0.004/lib/WWW/Pastebin/PastebinCom/Create.pm 2011-12-04 15:11:50.000000000 +0100 +++ WWW-Pastebin-PastebinCom-Create-0.004-patched/lib/WWW/Pastebin/PastebinCom/Create.pm 2012-11-19 23:58:13.459354318 +0100 @@ -45,6 +45,10 @@ $self->error( 'Missing or undefined `text` argument' ); return; } + unless ( defined $args{apikey} ) { + $self->error( 'Missing or undefined "apikey" argument' ); + return; + } # handle uri (deprecated argument) if ( exists $args{uri} ) @@ -63,8 +67,8 @@ format => 'text', expiry => 'd', poster => '', - email => '', %args, + api_option => 'paste', ); @@ -77,9 +81,9 @@ } # map onto expiration - my %expire = ( f => 'n', - d => '1d', - m => '1m' ); + my %expire = ( f => 'N', + d => '1D', + m => '1M' ); croak "Invalid `expiry` argument. Must be either 'f', 'd' or 'm'" if !exists $expire{$args{expiry}}; @@ -88,19 +92,18 @@ # map onto API parameters my %API = ( - poster => 'paste_name', - text => 'paste_code', - email => 'paste_email', - subdomain => 'paste_subdomain', - private => 'paste_private', - expiry => 'paste_expire_date', - format => 'paste_format', + apikey => 'api_dev_key', + poster => 'api_paste_name', + text => 'api_paste_code', + private => 'api_paste_private', + expiry => 'api_paste_expire_date', + format => 'api_paste_format', ); $args{$API{$_}} = delete $args{$_} foreach grep { defined $API{$_}} keys %args; - my $uri = URI->new( 'http://pastebin.com/api_public.php' ); + my $uri = URI->new( 'http://pastebin.com/api/api_post.php' ); my $response = $self->{ua}->post( $uri, \%args );
Thank you for your patch. I didn't have the time to apply it earlier, and it seems Pastebin changed their API again (applied patch still gets the "Use new api" message). Since the new API provides much more than simple pastebin creation, I have released WWW::Pastebin::PastebinCom::API and marked this module for deletion, as it is obsolete and useless.