Skip to content

Commit

Permalink
Remove Trailing Slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
joelklabo committed Dec 2, 2020
1 parent 72540cb commit a429299
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions code-ch06/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class TxFetcher:
@classmethod
def get_url(cls, testnet=False):
if testnet:
return 'http://testnet.programmingbitcoin.com'
return 'https://blockstream.info/testnet/api'
else:
return 'http://mainnet.programmingbitcoin.com'
return 'https://blockstream.info/api'

@classmethod
def fetch(cls, tx_id, testnet=False, fresh=False):
if fresh or (tx_id not in cls.cache):
url = '{}/tx/{}.hex'.format(cls.get_url(testnet), tx_id)
url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id)
response = requests.get(url)
try:
raw = bytes.fromhex(response.text.strip())
Expand Down
4 changes: 2 additions & 2 deletions code-ch07/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class TxFetcher:
@classmethod
def get_url(cls, testnet=False):
if testnet:
return 'https://blockstream.info/testnet/api/'
return 'https://blockstream.info/testnet/api'
else:
return 'https://blockstream.info/api/'
return 'https://blockstream.info/api'

@classmethod
def fetch(cls, tx_id, testnet=False, fresh=False):
Expand Down
4 changes: 2 additions & 2 deletions code-ch08/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class TxFetcher:
@classmethod
def get_url(cls, testnet=False):
if testnet:
return 'http://testnet.programmingbitcoin.com'
return 'https://blockstream.info/testnet/api'
else:
return 'http://mainnet.programmingbitcoin.com'
return 'https://blockstream.info/api'

@classmethod
def fetch(cls, tx_id, testnet=False, fresh=False):
Expand Down
4 changes: 2 additions & 2 deletions code-ch09/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class TxFetcher:
@classmethod
def get_url(cls, testnet=False):
if testnet:
return 'https://blockstream.info/testnet/api/'
return 'https://blockstream.info/testnet/api'
else:
return 'https://blockstream.info/api/'
return 'https://blockstream.info/api'

@classmethod
def fetch(cls, tx_id, testnet=False, fresh=False):
Expand Down
4 changes: 2 additions & 2 deletions code-ch10/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class TxFetcher:
@classmethod
def get_url(cls, testnet=False):
if testnet:
return 'http://testnet.programmingbitcoin.com'
return 'https://blockstream.info/testnet/api'
else:
return 'http://mainnet.programmingbitcoin.com'
return 'https://blockstream.info/api'

@classmethod
def fetch(cls, tx_id, testnet=False, fresh=False):
Expand Down
6 changes: 3 additions & 3 deletions code-ch12/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class TxFetcher:
@classmethod
def get_url(cls, testnet=False):
if testnet:
return 'http://testnet.programmingbitcoin.com'
return 'https://blockstream.info/testnet/api'
else:
return 'http://mainnet.programmingbitcoin.com'
return 'https://blockstream.info/api'

@classmethod
def fetch(cls, tx_id, testnet=False, fresh=False):
if fresh or (tx_id not in cls.cache):
url = '{}/tx/{}.hex'.format(cls.get_url(testnet), tx_id)
url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id)
response = requests.get(url)
try:
raw = bytes.fromhex(response.text.strip())
Expand Down
6 changes: 3 additions & 3 deletions code-ch13/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

class TxFetcher:
cache = {}

@classmethod
def get_url(cls, testnet=False):
if testnet:
return 'https://blockstream.info/testnet/api/'
return 'https://blockstream.info/testnet/api'
else:
return 'https://blockstream.info/api/'
return 'https://blockstream.info/api'

@classmethod
def fetch(cls, tx_id, testnet=False, fresh=False):
Expand Down

0 comments on commit a429299

Please sign in to comment.