Move API code to api.py #609

Merged
Atheros1 merged 7 commits from master into master 2014-01-13 01:58:07 +01:00
2 changed files with 21 additions and 16 deletions
Showing only changes of commit d150476e98 - Show all commits

View File

@ -1,6 +1,15 @@
# Copyright (c) 2012 Jonathan Warren # Copyright (c) 2012-2014 Jonathan Warren
# Copyright (c) 2012 The Bitmessage developers # Copyright (c) 2012-2014 The Bitmessage developers
# Moved API stuff from main program to here /EM
comment= """
This is not what you run to run the Bitmessage API. Instead, enable daemon mode
( https://bitmessage.org/wiki/Daemon ) then run bitmessagemain.py.
"""
if __name__ == "__main__":
print comment
import sys
sys.exit(0)
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
import json import json

View File

@ -14,16 +14,6 @@ import signal # Used to capture a Ctrl-C keypress so that Bitmessage can shutdo
import singleton import singleton
import os import os
# OSX python version check
import sys
if sys.platform == 'darwin':
if float("{1}.{2}".format(*sys.version_info)) < 7.5:
msg = "You should use python 2.7.5 or greater. Your version: %s", "{0}.{1}.{2}".format(*sys.version_info)
logger.critical(msg)
print msg
sys.exit(0)
from SimpleXMLRPCServer import SimpleXMLRPCServer from SimpleXMLRPCServer import SimpleXMLRPCServer
from bitmessageapi import MySimpleXMLRPCRequestHandler from bitmessageapi import MySimpleXMLRPCRequestHandler
@ -31,7 +21,6 @@ import shared
from helper_sql import sqlQuery from helper_sql import sqlQuery
import threading import threading
# Classes # Classes
#from helper_sql import * #from helper_sql import *
#from class_sqlThread import * #from class_sqlThread import *
@ -49,11 +38,19 @@ from debug import logger
# Helper Functions # Helper Functions
import helper_bootstrap import helper_bootstrap
import helper_generic import helper_generic
#import proofofwork
from subprocess import call from subprocess import call
import time import time
# OSX python version check
import sys
if sys.platform == 'darwin':
if float("{1}.{2}".format(*sys.version_info)) < 7.5:
msg = "You should use python 2.7.5 or greater. Your version: %s", "{0}.{1}.{2}".format(*sys.version_info)
logger.critical(msg)
print msg
sys.exit(0)
def connectToStream(streamNumber): def connectToStream(streamNumber):
shared.streamsInWhichIAmParticipating[streamNumber] = 'no data' shared.streamsInWhichIAmParticipating[streamNumber] = 'no data'
selfInitiatedConnections[streamNumber] = {} selfInitiatedConnections[streamNumber] = {}
@ -87,7 +84,6 @@ class singleAPI(threading.Thread):
# This is a list of current connections (the thread pointers at least) # This is a list of current connections (the thread pointers at least)
selfInitiatedConnections = {} selfInitiatedConnections = {}
if shared.useVeryEasyProofOfWorkForTesting: if shared.useVeryEasyProofOfWorkForTesting:
shared.networkDefaultProofOfWorkNonceTrialsPerByte = int( shared.networkDefaultProofOfWorkNonceTrialsPerByte = int(
shared.networkDefaultProofOfWorkNonceTrialsPerByte / 16) shared.networkDefaultProofOfWorkNonceTrialsPerByte / 16)