Making Twitter client with Net::Twitter, I reveals 4 points conflicting
between Official API and Net::Twitter module. Each confrictions are
itemized bellow. I made a slight modification patch on 1.17 version,
unpatched #40835 patch, in accordance with the 4 points, except for
removing archive method. I hope I've assisted the next release.
[1] Twitter API returns JSON non-object or non-array.
I got a following error message, when call test() function.
JSON text must be an object or array (but found number, string, true,
false or null, use allow_nonref to allow this) at
/usr/local/share/perl/5.8.8/JSON/Any.pm line 483.
Ngrep packet logs are on below:
GET /help/test.json HTTP/1.1.
TE: deflate,gzip;q=0.3.
Connection: TE, close.
Host: twitter.com.
User-Agent: Net::Twitter/1.17 (PERL).
X-Twitter-Client-URL:: http://x4.net/twitter/meta.xml.
X-Twitter-Client-Version:: 1.17.
X-Twitter-Client:: Perl Net::Twitter.
.
HTTP/1.1 200 OK.
Date: Tue, 02 Dec 2008 05:59:06 GMT.
Server: hi.
Last-Modified: Tue, 02 Dec 2008 05:59:06 GMT.
Status: 200 OK.
ETag: "72054d9a6fbdcc7df012e19f32345b65".
Pragma: no-cache.
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0,
post-check=0.
Content-Type: application/json; charset=utf-8.
Content-Length: 4.
Expires: Tue, 31 Mar 1981 05:00:00 GMT.
Set-Cookie:
_twitter_sess=BAh7CDoJdXNlcjA6B2lkIiVlYzdjOWIzZGFiOWQ4Y2UzYzYzM2YxOTQ4OTY2%250ANmU5MiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%250ASGFzaHsABjoKQHVzZWR7AA%253D%253D--c8dc1f34dccbc9a99015257ce03c778f62105522;
domain=.twitter.com; path=/.
Vary: Accept-Encoding.
Connection: close.
.
"ok"
It seems that some Twitter APIs, not only test method, returns such
non-object or non-array. Setting allow_noref option true by
JSON::Any->new(allow_nonref => 1)->jsonToObj(...) instead of
JSON::Any->jsonToObj(...) may clear up the error.
[2] An archive method is deprecated and is not listed on toc longer.
According to Twitter API Wiki / REST API
Documentation(http://apiwiki.twitter.com/REST+API+Documentation),
archive method no longer exist on table of contents. I tried to call
archive method as a test, and error has returnd with "Please call
user_timeline method."
GET /account/archive.json?page=1 HTTP/1.1.
TE: deflate,gzip;q=0.3.
Connection: TE, close.
Authorization: Basic ZzQ1ZzpxOTN2Z2hyZTM0OXZu.
Host: twitter.com.
User-Agent: Net::Twitter/1.17 (PERL).
X-Twitter-Client-URL:: http://x4.net/twitter/meta.xml.
X-Twitter-Client-Version:: 1.17.
X-Twitter-Client:: Perl Net::Twitter.
.
HTTP/1.1 403 Forbidden.
Date: Tue, 02 Dec 2008 10:04:01 GMT.
Server: hi.
Last-Modified: Tue, 02 Dec 2008 10:04:01 GMT.
Status: 403 Forbidden.
Pragma: no-cache.
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0,
post-check=0.
Content-Type: application/json; charset=utf-8.
Content-Length: 127.
Expires: Tue, 31 Mar 1981 05:00:00 GMT.
Set-Cookie:
_twitter_sess=BAh7BzoHaWQiJWQ5YWMyNmIwNDg2ZWQwMDEyNjdjYTIwMzc2NjQwOTBkIgpm%250AbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAG%250AOgpAdXNlZHsA--b9d2414195ff6d46200811c03188fc57cc79f01f;
domain=.twitter.com; path=/.
Vary: Accept-Encoding.
Connection: close.
.
{"request":"\/account\/archive.json?page=1","error":"This method is
deprecated. Please call \/statuses\/user_timeline.format."}
I don't think Net::Twitter needs to support archive method longer.
[3] Don't work relationship_exists method properly.
As already reported, relationship_exist methods doesn't work fine. 400
Bad request error is returnd when exist method are called through
Net::Twitter.
GET /friendships/exists.json HTTP/1.1.
TE: deflate,gzip;q=0.3.
Connection: TE, close.
Authorization: Basic ZzQ1ZzpxOTN2Z2hyZTM0OXZu.
Host: twitter.com.
User-Agent: Net::Twitter/1.17 (PERL).
X-Twitter-Client-URL:: http://x4.net/twitter/meta.xml.
X-Twitter-Client-Version:: 1.17.
X-Twitter-Client:: Perl Net::Twitter.
.
HTTP/1.1 400 Bad Request.
Date: Tue, 02 Dec 2008 10:54:34 GMT.
Server: hi.
Last-Modified: Tue, 02 Dec 2008 10:54:34 GMT.
Status: 400 Bad Request.
Pragma: no-cache.
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0,
post-check=0.
Content-Type: application/json; charset=utf-8.
Content-Length: 97.
Expires: Tue, 31 Mar 1981 05:00:00 GMT.
Set-Cookie:
_twitter_sess=BAh7BzoHaWQiJTljMDMzMmZhZDlkNGE2NmM3ZTljZTMyOWFjNzE1OTYzIgpm%250AbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAG%250AOgpAdXNlZHsA--36710f07f61fa1a2294c935d15799073ab1de3b2;
domain=.twitter.com; path=/.
Vary: Accept-Encoding.
Connection: close.
.
{"request":"\/friendships\/exists.json","error":"Two user ids or
screen_names must be supplied."}
The patch attached #40835: bug report works fine.
[4] New methods update_profile_colors, update_profile_image and
update_profile_background_image are added.
Net::Twitter 1.17 Version doesn't have these three methods, so I add the
methods.
Thank you for reading.
Subject: | Twitter.pm.patch |
Message body is not shown because it is too large.