Skip to content

Commit

Permalink
Merge c790cf4 into e538b7b
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Sep 18, 2019
2 parents e538b7b + c790cf4 commit 60f9c1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions datapackage/config.py
Expand Up @@ -7,6 +7,7 @@

# Module API

REMOTE_SCHEMES = ['http', 'https', 'ftp', 'ftps', 's3']
TABULAR_FORMATS = ['csv', 'tsv', 'xls', 'xlsx']
DEFAULT_DATA_PACKAGE_PROFILE = 'data-package'
DEFAULT_RESOURCE_PROFILE = 'data-resource'
Expand Down
6 changes: 3 additions & 3 deletions datapackage/resource.py
Expand Up @@ -12,7 +12,7 @@
import requests
from copy import deepcopy
from tableschema import Table, Storage
from six.moves.urllib.parse import urljoin
from six.moves.urllib.parse import urljoin, urlparse
from six.moves.urllib.request import urlopen
from .profile import Profile
from . import exceptions
Expand Down Expand Up @@ -489,10 +489,10 @@ def _inspect_source(data, path, base_path, storage):
elif len(path) == 1:

# Remote
if path[0].startswith('http'):
if urlparse(path[0]).scheme in config.REMOTE_SCHEMES:
inspection['source'] = path[0]
inspection['remote'] = True
elif base_path and base_path.startswith('http'):
elif base_path and urlparse(base_path).scheme in config.REMOTE_SCHEMES:
norm_base_path = base_path if base_path.endswith('/') else base_path + '/'
inspection['source'] = urljoin(norm_base_path, path[0])
inspection['remote'] = True
Expand Down

0 comments on commit 60f9c1b

Please sign in to comment.