So when you are going to set up these keys, you've got to go into this web site.
You've got to get these values.
You get this token.
You got this key.
You got this secret.
You got this token secret.
And they're just these big long crazy strings.
And there is this file called hidden.py on the sample code.
And you have got to cut and paste
the four values that you get from the Twitter web site after you've logged in.
It will give you these values and
you'll have to put them in, so hidden.py is part of twurl
that makes this thing.
So, you have to get these right, and
if you don't get these right, your Twitter code's not going to work.
And I'll show you how to do that in a recorded video.
It uses a protocol called OAuth, and basically what we're doing is we're
signing URLs, and so it's not just a URL. It's a URL plus the signature on the URL.
And it's signed in a way that only you as long as you know the keys and
the secrets can sign that stuff.
And so this is the Twitter URL code that I've written.
hidden.py is what you have to write.
You put all those four strings in there, and that's the consumer_key,
the consumer_secret, the token_key and the token_secret.
You set all that, and then I call this oauth library,
that's not your code, that's actually part of Python that does this oauth.
And when it's all said and done, we do all these things, make a request and
then we sign this request and then we convert it to a URL.
When it's all said and done, the url looks like this.
These are the, this is the data we're interested in. We're looking for
count of 2 and the screen_name of drchuck and then all of this stuff that says
oauth_version equals oauth_token, oauth_timestamp, oauth_signature.
All of these stuff is the magic stuff that is part of that signed URL, okay?
Now you don't have to worry about that, because as long as you get hidden.py and
you called twurl, you'll get back this big long URL.
And you hit that with urlopen, and Twitter will read these things
and say good numbers, good numbers.
Okay, here's your data.
And if you don't know what this data, if you don't have these secrets right,
then you can't see it. And it also is a way for Twitter to know if it's you requesting
the data or me requesting the data because somewhere in here is who I am.
Not screen name equals Dr. Chuck, that's the data we're actually asking for.
But the key, and the consumer key, and the consumer secret are the trick
where it says, hey this is Chuck having logged in asking for API data.
And so that is how Twitter basically knows how many you've done and
how many I've done so you get 15 and I get 15.
But once I run out of 15, I can't use anymore.