fork download
  1. import oauth2 as oauth
  2. import requests
  3. import time
  4.  
  5. url = "https://r...content-available-to-author-only...e.com/app/site/hosting/restlet.nl?script=10&deploy=1"
  6. token = oauth.Token(key="70e2393164535f7f8899fb90c4a5e3fc6d86c2ee6607b199323f37d468418d1c", secret="197ce3250c0c6466c2f0196ab918eefb8169c00e8324cf648e73e927bf33ea16")
  7. consumer = oauth.Consumer(key="11e54fb91676d305ab805a6f0344d143694411fc4fa9f97ecf8d4abea8a04fd8", secret="10b55ad46a03ce392dbdfc0d8197914d0cf2c02d5297da6d6af750178a89d926")
  8.  
  9. http_method = "GET"
  10. realm="TSTDRV877548"
  11.  
  12. params = {
  13. 'oauth_version': "1.0",
  14. 'oauth_nonce': oauth.generate_nonce(),
  15. 'oauth_timestamp': str(int(time.time())),
  16. 'oauth_token': token.key,
  17. 'oauth_consumer_key': consumer.key
  18. }
  19.  
  20. req = oauth.Request(method=http_method, url=url, parameters=params)
  21. signature_method = oauth.SignatureMethod_HMAC_SHA1()
  22. req.sign_request(signature_method, consumer, token)
  23. header = req.to_header(realm)
  24. headery = header['Authorization'].encode('ascii', 'ignore')
  25. headerx = {"Authorization": headery, "Content-Type":"application/json"}
  26. print(headerx)
  27. conn = requests.get("https://r...content-available-to-author-only...e.com/app/site/hosting/restlet.nl?script=10&deploy=1",headers=headerx)
  28. print(conn.text)
Runtime error #stdin #stdout #stderr 0.01s 23352KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 1, in <module>
ImportError: No module named oauth2