Skip to content

Commit

Permalink
Update py-ipfs-api to use its new name.
Browse files Browse the repository at this point in the history
Fix client invocation per the new API module's docs.

Fixes #608
  • Loading branch information
machawk1 committed May 27, 2019
1 parent 0b9bb3e commit 12d4dc2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions ipwb/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import sys
import os
import json
import ipfsapi
import ipfshttpclient as ipfsapi
import argparse
import zlib
import surt
Expand All @@ -26,7 +26,7 @@
from warcio.recordloader import ArchiveLoadFailed

from requests.packages.urllib3.exceptions import NewConnectionError
from ipfsapi.exceptions import ConnectionError
from ipfshttpclient.exceptions import ConnectionError
# from requests.exceptions import ConnectionError

from six.moves import input
Expand All @@ -52,7 +52,7 @@

DEBUG = False

IPFS_API = ipfsapi.Client(IPFSAPI_HOST, IPFSAPI_PORT)
IPFS_API = ipfsapi.Client(f"/dns/{IPFSAPI_HOST}/tcp/{IPFSAPI_PORT}/http")


def s2b(s): # Convert str to bytes, cross-py
Expand Down
6 changes: 3 additions & 3 deletions ipwb/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from __future__ import print_function
import sys
import os
import ipfsapi
import ipfshttpclient as ipfsapi
import json
import subprocess
import pkg_resources
Expand All @@ -28,7 +28,7 @@
from flask import abort
from flask import render_template

from ipfsapi.exceptions import StatusError as hashNotInIPFS
from ipfshttpclient.exceptions import StatusError as hashNotInIPFS
from bisect import bisect_left
from socket import gaierror
from socket import error as socketerror
Expand Down Expand Up @@ -68,7 +68,7 @@
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.debug = False

IPFS_API = ipfsapi.Client(IPFSAPI_HOST, IPFSAPI_PORT)
IPFS_API = ipfsapi.Client(f"/dns/{IPFSAPI_HOST}/tcp/{IPFSAPI_PORT}/http")


@app.context_processor
Expand Down
6 changes: 3 additions & 3 deletions ipwb/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import sys
import requests
import ipfsapi
import ipfshttpclient as ipfsapi

import re
# Datetime conversion to rfc1123
Expand All @@ -22,7 +22,7 @@
from pkg_resources import parse_version

# from requests.exceptions import ConnectionError
from ipfsapi.exceptions import ConnectionError
from ipfshttpclient.exceptions import ConnectionError


IPFSAPI_HOST = 'localhost'
Expand All @@ -41,7 +41,7 @@

def isDaemonAlive(hostAndPort="{0}:{1}".format(IPFSAPI_HOST, IPFSAPI_PORT)):
"""Ensure that the IPFS daemon is running via HTTP before proceeding"""
client = ipfsapi.Client(IPFSAPI_HOST, IPFSAPI_PORT)
client = ipfsapi.Client(f"/dns/{IPFSAPI_HOST}/tcp/{IPFSAPI_PORT}/http")

try:
# ConnectionError/AttributeError if IPFS daemon not running
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warcio>=1.5.3
ipfsapi>=0.4.2
ipfshttpclient>=0.4.12
Flask==0.12.3
pycryptodome>=3.4.11
requests>=2.19.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
install_requires=[
'warcio>=1.5.3',
'ipfsapi>=0.4.2',
'ipfshttpclient>=0.4.12',
'Flask==0.12.3',
'pycryptodome>=3.4.11',
'requests>=2.19.1',
Expand Down

0 comments on commit 12d4dc2

Please sign in to comment.