It appears that I am hitting a 150 post rate limit when I use the
statuses/update.xml api to update a twitter account eventhough I
should not have this limit doing only a post. Is there a reason why?
Here is the code I am using from oracle to do this:

create or replace PACKAGE BODY tweet
AS

  twit_host VARCHAR2(255) := 'api.twitter.com';
  twit_protocol VARCHAR2(10) := 'http://';

  -- URL for status updates
  tweet_url VARCHAR2(255) := '/1/statuses/update.xml';


  FUNCTION tweet
    (
      p_user IN VARCHAR2,
      p_pwd IN VARCHAR2,
      p_string IN VARCHAR2,
      p_proxy_url IN VARCHAR2 DEFAULT NULL,
      p_no_domains IN VARCHAR2 DEFAULT NULL )
    RETURN BOOLEAN
  AS
    v_req   UTL_HTTP.REQ;  -- HTTP request ID
    v_resp  UTL_HTTP.RESP;  -- HTTP response ID
    v_value VARCHAR2(1024); -- HTTP response data
    v_status VARCHAR2(160);   -- Status of the request
    v_call VARCHAR2(2000);  -- The request URL
    v_log_value varchar2(4000) := 'status';
  BEGIN

    -- Twitter update url
    v_call := twit_protocol ||
              twit_host ||
              tweet_url;

    -- encoded status string
    v_status := utl_url.escape(
      url => 'status=' || SUBSTR( short_url.encode_text(p_string) ,
1,140));

    -- Authenticate via proxy
    -- Proxy string looks like 'http://username:passw...@proxy.com'
    -- p_no_domains is a list of domains not to use the proxy for
    -- These settings override the defaults that are configured at the
database level
    IF p_proxy_url IS NOT NULL
    THEN
      Utl_Http.set_proxy (
        proxy                 => p_proxy_url,
        no_proxy_domains      => p_no_domains
        );
    END IF;

    -- Has to be a POST for status update
    v_req := UTL_HTTP.BEGIN_REQUEST(
          url => v_call,
      method =>'POST');

    -- Pretend we're a moz browser
    UTL_HTTP.SET_HEADER(
      r => v_req,
      name => 'User-Agent',
      value => 'Mozilla/4.0');

    -- Pretend we're coming from an html form
    UTL_HTTP.SET_HEADER(
      r => v_req,
      name => 'Content-Type',
      value => 'application/x-www-form-urlencoded');

    -- Set the length of the input
    UTL_HTTP.SET_HEADER(
      r => v_req,
      name => 'Content-Length',
      value => length(v_status));

    -- authenticate with twitter user/pass
    UTL_HTTP.SET_AUTHENTICATION(
      r => v_req,
      username => p_user,
      password => p_pwd );

    -- Send the update
    UTL_HTTP.WRITE_TEXT(
      r => v_req,
      data => v_status );

    UTL_HTTP.end_request (v_req);

    RETURN TRUE;

  EXCEPTION
    -- normal exception when reading the response
    WHEN UTL_HTTP.END_OF_BODY THEN
            UTL_HTTP.end_request (v_req);
          RETURN TRUE;

    -- Anything else and send false
    WHEN OTHERS THEN
      UTL_HTTP.end_request (v_req);
      Dbms_Output.Put_Line ( 'Request_Failed: ' ||
Utl_Http.Get_Detailed_Sqlerrm );
      Dbms_Output.Put_Line ( 'Ora: ' || Sqlerrm );
         RETURN FALSE;

  END;

END tweet;



Thanks

Reply via email to