Skip to content

Commit 5970064

Browse files
committed
Testing to see if Markdown formatting is automagic like @rk says it is.
1 parent c773302 commit 5970064

File tree

1 file changed

+32
-34
lines changed

1 file changed

+32
-34
lines changed

README.md

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,38 @@ This code was originally forked from [Leah Culver and Andy Smith's oauth.py code
1111

1212
# Signing a Request
1313

14-
<pre><code>
15-
import oauth2 as oauth
16-
import time
17-
18-
# Set the API endpoint
19-
url = "http://example.com/photos"
20-
21-
# Set the base oauth_* parameters along with any other parameters required
22-
# for the API call.
23-
params = {
24-
'oauth_version': "1.0",
25-
'oauth_nonce': oauth.generate_nonce(),
26-
'oauth_timestamp': int(time.time())
27-
'user': 'joestump',
28-
'photoid': 555555555555
29-
}
30-
31-
# Set up instances of our Token and Consumer. The Consumer.key and
32-
# Consumer.secret are given to you by the API provider. The Token.key and
33-
# Token.secret is given to you after a three-legged authentication.
34-
token = oauth.Token(key="tok-test-key", secret="tok-test-secret")
35-
consumer = oauth.Consumer(key="con-test-key", secret="con-test-secret")
36-
37-
# Set our token/key parameters
38-
params['oauth_token'] = tok.key
39-
params['oauth_consumer_key'] = con.key
40-
41-
# Create our request. Change method, etc. accordingly.
42-
req = oauth.Request(method="GET", url=url, parameters=params)
43-
44-
# Sign the request.
45-
signature_method = oauth.SignatureMethod_HMAC_SHA1()
46-
req.sign_request(signature_method, consumer, token)
47-
</code></pre>
14+
import oauth2 as oauth
15+
import time
16+
17+
# Set the API endpoint
18+
url = "http://example.com/photos"
19+
20+
# Set the base oauth_* parameters along with any other parameters required
21+
# for the API call.
22+
params = {
23+
'oauth_version': "1.0",
24+
'oauth_nonce': oauth.generate_nonce(),
25+
'oauth_timestamp': int(time.time())
26+
'user': 'joestump',
27+
'photoid': 555555555555
28+
}
29+
30+
# Set up instances of our Token and Consumer. The Consumer.key and
31+
# Consumer.secret are given to you by the API provider. The Token.key and
32+
# Token.secret is given to you after a three-legged authentication.
33+
token = oauth.Token(key="tok-test-key", secret="tok-test-secret")
34+
consumer = oauth.Consumer(key="con-test-key", secret="con-test-secret")
35+
36+
# Set our token/key parameters
37+
params['oauth_token'] = tok.key
38+
params['oauth_consumer_key'] = con.key
39+
40+
# Create our request. Change method, etc. accordingly.
41+
req = oauth.Request(method="GET", url=url, parameters=params)
42+
43+
# Sign the request.
44+
signature_method = oauth.SignatureMethod_HMAC_SHA1()
45+
req.sign_request(signature_method, consumer, token)
4846

4947
# Using the Client
5048

0 commit comments

Comments
 (0)