PEERBET FREE SATOSHI EARNER


SUBMITTED BY: Guest

DATE: Feb. 22, 2013, 9:43 p.m.

FORMAT: Python

SIZE: 2.9 kB

HITS: 1780

  1. ##############################################################################
  2. # save this script to peerbetsatoshibot.py #
  3. # #
  4. # TO RUN IT USE THIS CODE #
  5. # python -u peerbetsatoshibot.py USERNAME PASSWORD #
  6. # PLEASE DONATE SOME TO: 1FpHgWtpQ5bynPpvNXsWbDQNqv6zWJgBv7 #
  7. ##############################################################################
  8. import cookielib, urllib2,urllib,random,time,sys,traceback,StringIO,gzip
  9. def call(opener,url,params=None):
  10. time.sleep(1)
  11. url=url+'&compress=1'
  12. if params is not None:
  13. uri=url+"&"+params
  14. else: uri=url
  15. try:
  16. opener.addheaders=[("Accept-Encoding", "gzip")]
  17. # print uri
  18. f=opener.open(uri)
  19. response=f.read()
  20. except urllib2.URLError:
  21. time.sleep(random.uniform(1,5))
  22. return call(opener,url,params)
  23. read=f.info().getheader("Content-Encoding")
  24. if read=='gzip':
  25. sio = StringIO.StringIO(response)
  26. sio.seek(0)
  27. gz=gzip.GzipFile(None,mode='rb',fileobj=sio)
  28. response= gz.read()
  29. gz.close()
  30. sio.close()
  31. # print response
  32. if response is None:
  33. return call(opener,url,params)
  34. else:
  35. try:
  36. read=eval(response)
  37. except:
  38. print '>>> traceback <<<'
  39. traceback.print_exc()
  40. print '>>> end of traceback <<<'
  41. time.sleep(random.uniform(1,5))
  42. return call(opener,url,params)
  43. error=None
  44. try:
  45. error= read['error']
  46. print "|",error,"|"
  47. except:
  48. return read
  49. if 'limit' in str(error):
  50. time.sleep(random.uniform(1,5))
  51. return call(opener,url,params)
  52. else: raise NameError(error)
  53. def login(opener):
  54. global password
  55. global username
  56. params = urllib.urlencode({'username': username, 'password': password})
  57. print "login",call(opener,'https://peerbet.org/api.php?method=login',params)
  58. if sys.argv[1] is not None: username=sys.argv[1]
  59. if sys.argv[2] is not None: password=sys.argv[2]
  60. while True:
  61. try:
  62. cj = cookielib.CookieJar()
  63. opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  64. params = urllib.urlencode({'username': username, 'password': password})
  65. print call(opener,"https://peerbet.org/api.php?method=login",params)
  66. params = urllib.urlencode({'message': 'satoshi'})
  67. message=call(opener,"https://peerbet.org/api.php?method=postchatmessage",params)
  68. print message['message_id'];
  69. except:
  70. print '>>> traceback <<<'
  71. traceback.print_exc()
  72. print '>>> end of traceback <<<'
  73. time.sleep(random.uniform(60*60,2*60*60))

comments powered by Disqus