mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
refactors project structure
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,9 +1,12 @@
|
||||
.vscode/
|
||||
.idea/
|
||||
*.log
|
||||
.DS_Store
|
||||
/pisa-btc/venv/*
|
||||
venv/
|
||||
conf.py
|
||||
bitcoin.conf*
|
||||
*__pycache__
|
||||
.pending*
|
||||
pisa-btc/apps/cli/*.json
|
||||
apps/cli/*.json
|
||||
appointments/
|
||||
test.py
|
||||
|
||||
@@ -10,11 +10,11 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||
RUN python3 get-pip.py
|
||||
|
||||
# Add pisa files
|
||||
ADD pisa-btc /root/pisa-btc
|
||||
WORKDIR /root/pisa-btc
|
||||
ADD pisa /root/pisa_btc
|
||||
WORKDIR /root/pisa_btc
|
||||
|
||||
# Export pythonpath
|
||||
RUN echo export PYTHONPATH="$PYTHONPATH:/root/pisa-btc/" >> /root/.bashrc
|
||||
RUN echo export PYTHONPATH="$PYTHONPATH:/root/pisa_btc/" >> /root/.bashrc
|
||||
|
||||
# Install dependencies
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
@@ -7,8 +7,8 @@ import json
|
||||
|
||||
|
||||
# FIXME: HERE FOR TESTING (get_block_count). REMOVE WHEN REMOVING THE FUNCTION
|
||||
from utils.authproxy import AuthServiceProxy
|
||||
from conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
||||
from pisa.utils.authproxy import AuthServiceProxy
|
||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
||||
|
||||
# ToDo: #5-add-async-to-api
|
||||
app = Flask(__name__)
|
||||
@@ -61,13 +61,13 @@ def get_appointment():
|
||||
locator = request.args.get('locator')
|
||||
response = []
|
||||
|
||||
job_in_watcher = watcher.appointments.get(locator)
|
||||
appointment_in_watcher = watcher.appointments.get(locator)
|
||||
|
||||
if job_in_watcher:
|
||||
for job in job_in_watcher:
|
||||
job_data = job.to_json()
|
||||
job_data['status'] = "being_watched"
|
||||
response.append(job_data)
|
||||
if appointment_in_watcher:
|
||||
for appointment in appointment_in_watcher:
|
||||
appointment_data = appointment.to_json()
|
||||
appointment_data['status'] = "being_watched"
|
||||
response.append(appointment_data)
|
||||
|
||||
if watcher.responder:
|
||||
responder_jobs = watcher.responder.jobs
|
||||
@@ -1,9 +1,9 @@
|
||||
import re
|
||||
from pisa.appointment import Appointment
|
||||
from pisa import errors
|
||||
from utils.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, MIN_DISPUTE_DELTA, SUPPORTED_CIPHERS, \
|
||||
SUPPORTED_HASH_FUNCTIONS
|
||||
from pisa.utils.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, MIN_DISPUTE_DELTA, \
|
||||
SUPPORTED_CIPHERS, SUPPORTED_HASH_FUNCTIONS
|
||||
|
||||
|
||||
class Inspector:
|
||||
@@ -1,12 +1,11 @@
|
||||
import logging
|
||||
from sys import argv
|
||||
from getopt import getopt
|
||||
from conf import SERVER_LOG_FILE
|
||||
from threading import Thread
|
||||
from pisa.api import start_api
|
||||
from pisa.tools import can_connect_to_bitcoind, in_correct_network
|
||||
from utils.authproxy import AuthServiceProxy
|
||||
from conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, BTC_NETWORK
|
||||
from pisa.utils.authproxy import AuthServiceProxy
|
||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, BTC_NETWORK, SERVER_LOG_FILE
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -5,8 +5,8 @@ from binascii import unhexlify
|
||||
from pisa.zmq_subscriber import ZMQHandler
|
||||
from pisa.rpc_errors import *
|
||||
from pisa.tools import check_tx_in_chain
|
||||
from utils.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
||||
from pisa.utils.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
||||
|
||||
CONFIRMATIONS_BEFORE_RETRY = 6
|
||||
MIN_CONFIRMATIONS = 6
|
||||
@@ -16,6 +16,7 @@ MAX_APPOINTMENTS = 100
|
||||
EXPIRY_DELTA = 6
|
||||
MIN_DISPUTE_DELTA = 20
|
||||
SERVER_LOG_FILE = 'pisa.log'
|
||||
DB_PATH = 'appointments/'
|
||||
|
||||
# PISA-CLI
|
||||
CLIENT_LOG_FILE = 'pisa.log'
|
||||
@@ -1,4 +1,4 @@
|
||||
from utils.authproxy import JSONRPCException
|
||||
from pisa.utils.authproxy import JSONRPCException
|
||||
from pisa.rpc_errors import RPC_INVALID_ADDRESS_OR_KEY
|
||||
from http.client import HTTPException
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
from binascii import hexlify, unhexlify
|
||||
from queue import Queue
|
||||
from threading import Thread
|
||||
from conf import EXPIRY_DELTA
|
||||
from pisa.responder import Responder
|
||||
from pisa.zmq_subscriber import ZMQHandler
|
||||
from utils.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from pisa.utils.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from hashlib import sha256
|
||||
from conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, MAX_APPOINTMENTS
|
||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, MAX_APPOINTMENTS, EXPIRY_DELTA
|
||||
|
||||
|
||||
class Watcher:
|
||||
@@ -1,6 +1,6 @@
|
||||
import zmq
|
||||
import binascii
|
||||
from conf import FEED_PROTOCOL, FEED_ADDR, FEED_PORT
|
||||
from pisa.conf import FEED_PROTOCOL, FEED_ADDR, FEED_PORT
|
||||
|
||||
# ToDo: #7-add-async-back-to-zmq
|
||||
class ZMQHandler:
|
||||
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
@@ -1,10 +1,10 @@
|
||||
import logging
|
||||
from pisa.inspector import Inspector
|
||||
from pisa.appointment import Appointment
|
||||
from conf import TEST_LOG_FILE
|
||||
from pisa import errors
|
||||
from utils.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, SUPPORTED_HASH_FUNCTIONS, SUPPORTED_CIPHERS
|
||||
from pisa.utils.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, SUPPORTED_HASH_FUNCTIONS, \
|
||||
SUPPORTED_CIPHERS, TEST_LOG_FILE
|
||||
|
||||
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO, handlers=[
|
||||
logging.FileHandler(TEST_LOG_FILE)
|
||||
Reference in New Issue
Block a user