[twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Correa Denzil
Hi,

I am performing OAuth to sign my requests. I am not developing a web
app. I am trying to harvest some user data. Here's what I do :

import oauth2 as oauth
import time

CONSUMER_KEY = 'xx'
CONSUMER_SECRET = 'xx'
access_key = 'xx'
access_secret_key = 'xxx'

consumer = oauth.Consumer(CONSUMER_KEY, CONSUMER_SECRET)
token = oauth.Token(access_key, access_secret_key)

client = oauth.Client(consumer)

# Set the API end point
url = 'http://api.twitter.com/1'

params = {'oauth_version': 1.0,
  'oauth_nonce': oauth.generate_nonce(),
  'oauth_timestamp': int(time.time()),
  'oauth_token': access_key,
  'oauth_consumer_key': consumer.key,
  'screen_name' : 'denzil_correa'
  }

req = oauth.Request(method=GET, url=url, parameters=params)

# Sign the request.
signature_method = oauth.SignatureMethod_HMAC_SHA1()
req.sign_request(signature_method, consumer, token)

### Make the auth request ###

test = 'http://api.twitter.com/1/account/rate_limit_status.json'

resp, content = client.request(test, GET)

print resp
print content # prints 'ok'



Here's  the output:

{reset_time:Mon Jun 06 14:54:50 +
2011,remaining_hits:132,hourly_limit:150,reset_time_in_seconds:1307372090}


Am I missing something?


--Regards,
Denzil

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Tom van der Woerdt

Is that Python? Anyway, not relevant.

1. You aren't signing using the proper url.
2. You aren't using anything related to the signature on the request (req).

Tom


On 6/6/11 4:43 PM, Correa Denzil wrote:

Hi,

I am performing OAuth to sign my requests. I am not developing a web
app. I am trying to harvest some user data. Here's what I do :

import oauth2 as oauth
import time

CONSUMER_KEY = 'xx'
CONSUMER_SECRET = 'xx'
access_key = 'xx'
access_secret_key = 'xxx'

consumer = oauth.Consumer(CONSUMER_KEY, CONSUMER_SECRET)
token = oauth.Token(access_key, access_secret_key)

client = oauth.Client(consumer)

# Set the API end point
url = 'http://api.twitter.com/1'

params = {'oauth_version': 1.0,
   'oauth_nonce': oauth.generate_nonce(),
   'oauth_timestamp': int(time.time()),
   'oauth_token': access_key,
   'oauth_consumer_key': consumer.key,
   'screen_name' : 'denzil_correa'
   }

req = oauth.Request(method=GET, url=url, parameters=params)

# Sign the request.
signature_method = oauth.SignatureMethod_HMAC_SHA1()
req.sign_request(signature_method, consumer, token)

### Make the auth request ###

test = 'http://api.twitter.com/1/account/rate_limit_status.json'

resp, content = client.request(test, GET)

print resp
print content # prints 'ok'



Here's  the output:

{reset_time:Mon Jun 06 14:54:50 +
2011,remaining_hits:132,hourly_limit:150,reset_time_in_seconds:1307372090}


Am I missing something?


--Regards,
Denzil



--
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Correa Denzil
Is that Python? : Yes

1. You aren't signing using the proper url.
Is the end point URL wrong?

2. You aren't using anything related to the signature on the request (req)
I am a newbie to Python. I am trying to dabble using OAuth. I
understand the OAuth flow but somehow what I am doing seems a bit
tangential to what OAuth is meant for. What should I do to rectify it
?

--Regards,
Denzil




On Mon, Jun 6, 2011 at 8:16 PM, Tom van der Woerdt i...@tvdw.eu wrote:
 You aren't using anything related to the signature on the request (req).

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Tom van der Woerdt
1. You don't sign the test variable, you sign the URL variable, which 
isn't an endpoint.
2. You don't use the req variable to make the request, but instead you 
create a new connection which is completely unrelated to the signed request.


Tom


On 6/6/11 4:54 PM, Correa Denzil wrote:

Is that Python? : Yes

1. You aren't signing using the proper url.
Is the end point URL wrong?

2. You aren't using anything related to the signature on the request (req)
I am a newbie to Python. I am trying to dabble using OAuth. I
understand the OAuth flow but somehow what I am doing seems a bit
tangential to what OAuth is meant for. What should I do to rectify it
?

--Regards,
Denzil




On Mon, Jun 6, 2011 at 8:16 PM, Tom van der Woerdti...@tvdw.eu  wrote:

You aren't using anything related to the signature on the request (req).


--
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Correa Denzil
Tom :

Thanks for the reply.

1. You don't sign the test variable, you sign the URL variable, which
isn't an endpoint.
I have changed the same

2. You don't use the req variable to make the request, but instead you
create a new connection which is completely unrelated to the signed
request.

I don't understand this point. What's the change am I supposed to make ?

I have opened up a gist for easier editing : https://gist.github.com/1010430

--Regards,
Denzil




On Mon, Jun 6, 2011 at 8:30 PM, Tom van der Woerdt i...@tvdw.eu wrote:
 1. You don't sign the test variable, you sign the URL variable, which isn't
 an endpoint.
 2. You don't use the req variable to make the request, but instead you
 create a new connection which is completely unrelated to the signed request.

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Tom van der Woerdt
In the Make the auth request part you make a request using client 
instead of the already prepared and signed req variable. You should 
use req to make the request.


Tom

On 6/6/11 5:10 PM, Correa Denzil wrote:

Tom :

Thanks for the reply.

1. You don't sign the test variable, you sign the URL variable, which
isn't an endpoint.
I have changed the same

2. You don't use the req variable to make the request, but instead you
create a new connection which is completely unrelated to the signed
request.

I don't understand this point. What's the change am I supposed to make ?

I have opened up a gist for easier editing : https://gist.github.com/1010430

--Regards,
Denzil




On Mon, Jun 6, 2011 at 8:30 PM, Tom van der Woerdti...@tvdw.eu  wrote:

1. You don't sign the test variable, you sign the URL variable, which isn't
an endpoint.
2. You don't use the req variable to make the request, but instead you
create a new connection which is completely unrelated to the signed request.


--
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Correa Denzil
Tom :

Are you sure? This gives me a :

Traceback (most recent call last):
  File oauth_test.py, line 41, in module
resp, content = req.request(url, GET)
AttributeError: 'Request' object has no attribute 'request'

--Regards,
Denzil




On Mon, Jun 6, 2011 at 8:49 PM, Tom van der Woerdt i...@tvdw.eu wrote:

 On 6/6/11 5:10 PM, Correa Denzil wro

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Tom van der Woerdt
Well, of course, don't literally replace the variables, but figure out a 
way to use the req object. I don't know anything about that object so I 
can't help you there.


Tom


On 6/6/11 5:28 PM, Correa Denzil wrote:

Tom :

Are you sure? This gives me a :

Traceback (most recent call last):
   File oauth_test.py, line 41, inmodule
 resp, content = req.request(url, GET)
AttributeError: 'Request' object has no attribute 'request'

--Regards,
Denzil




On Mon, Jun 6, 2011 at 8:49 PM, Tom van der Woerdti...@tvdw.eu  wrote:

On 6/6/11 5:10 PM, Correa Denzil wro


--
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Correa Denzil
Well, it turns out it's not the case. Both the points you mentioned
weren't the issue as I see it.

The issue was while I was creating the client I wasn't supplying the
token. Check Line 20 in the gist.

https://gist.github.com/1010430

--Regards,
Denzil




On Mon, Jun 6, 2011 at 8:58 PM, Correa Denzil mcen...@gmail.com wrote:
 Tom :

 Are you sure? This gives me a :

 Traceback (most recent call last):
  File oauth_test.py, line 41, in module
    resp, content = req.request(url, GET)
 AttributeError: 'Request' object has no attribute 'request'

 --Regards,
 Denzil




 On Mon, Jun 6, 2011 at 8:49 PM, Tom van der Woerdt i...@tvdw.eu wrote:

 On 6/6/11 5:10 PM, Correa Denzil wro


-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Tom van der Woerdt
In that case, try removing everything related to the req variable. Seems 
it's all unrelated to the actual request (unless the oauth library is 
very badly designed, of course). Line 22 all the way up to 35.


Tom


On 6/6/11 5:38 PM, Correa Denzil wrote:

Well, it turns out it's not the case. Both the points you mentioned
weren't the issue as I see it.

The issue was while I was creating the client I wasn't supplying the
token. Check Line 20 in the gist.

https://gist.github.com/1010430

--Regards,
Denzil




On Mon, Jun 6, 2011 at 8:58 PM, Correa Denzilmcen...@gmail.com  wrote:

Tom :

Are you sure? This gives me a :

Traceback (most recent call last):
  File oauth_test.py, line 41, inmodule
resp, content = req.request(url, GET)
AttributeError: 'Request' object has no attribute 'request'

--Regards,
Denzil




On Mon, Jun 6, 2011 at 8:49 PM, Tom van der Woerdti...@tvdw.eu  wrote:

On 6/6/11 5:10 PM, Correa Denzil wro


--
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Oauth Rate Limit 150 per hour?

2011-06-06 Thread Correa Denzil
Yes, it works. Thanks :-)

--Regards,
Denzil




On Mon, Jun 6, 2011 at 9:10 PM, Tom van der Woerdt i...@tvdw.eu wrote:
 In that case, try removing everything related to the req variable. Seems
 it's all unrelated to the actual request (unless the oauth library is very
 badly designed, of course). Line 22 all the way up to 35.

 Tom


 On 6/6/11 5:38 PM, Correa Denzil wrote:

 Well, it turns out it's not the case. Both the points you mentioned
 weren't the issue as I see it.

 The issue was while I was creating the client I wasn't supplying the
 token. Check Line 20 in the gist.

 https://gist.github.com/1010430

 --Regards,
 Denzil




 On Mon, Jun 6, 2011 at 8:58 PM, Correa Denzilmcen...@gmail.com  wrote:

 Tom :

 Are you sure? This gives me a :

 Traceback (most recent call last):
  File oauth_test.py, line 41, inmodule
    resp, content = req.request(url, GET)
 AttributeError: 'Request' object has no attribute 'request'

 --Regards,
 Denzil




 On Mon, Jun 6, 2011 at 8:49 PM, Tom van der Woerdti...@tvdw.eu  wrote:

 On 6/6/11 5:10 PM, Correa Denzil wro

 --
 Twitter developer documentation and resources: https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk


-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk