Guest User

Untitled

a guest
Feb 18th, 2018
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. from __future__ import print_function
  2. import requests, json
  3.  
  4. rpcPort = 8332
  5. rpcUser = 'xxxxx'
  6.  
  7. rpcPassword = 'xxxxx'
  8. serverURL = 'http://' + rpcUser + ':' + rpcPassword + '@localhost:' + str(rpcPort)
  9.  
  10. headers = {'content-type': 'application/json'}
  11. payload = json.dumps({"method": 'getblock', "params": ["0000000000005e5fd51f764d230441092f1b69d1a1eeab334c5bb32412e8dc51"], "jsonrpc": "2.0"})
  12. response = requests.get(serverURL, headers=headers, data=payload)
  13. print(response.json()['result'])
  14.  
  15. Traceback (most recent call last):
  16. File "/home/phglz/Desktop/pruebapython.py", line 17, in <module>
  17. print(response.json()['result'])
  18. File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 892, in json
  19. return complexjson.loads(self.text, **kwargs)
  20. File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
  21. return _default_decoder.decode(s)
  22. File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
  23. obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  24. File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
  25. raise ValueError("No JSON object could be decoded")
  26. ValueError: No JSON object could be decoded
  27. [Finished in 0.1s with exit code 1]
  28. [shell_cmd: python -u "/home/phglz/Desktop/pruebapython.py"]
  29. [dir: /home/phglz/Desktop]
  30. [path: /home/phglz/bin:/home/phglz/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin]
  31.  
  32. rpcuser=xxxx
  33. rpcpassword=xxxx
  34. daemon=1
  35. keypool=10000
  36. maxuploadtarget=20
  37. maxconnections=16
Add Comment
Please, Sign In to add comment