Skip to content

Commit eb09a1a

Browse files
author
Bartek Kwiecien
committed
Added CNAME to config
1 parent 1a6fbf8 commit eb09a1a

File tree

5 files changed

+32
-19
lines changed

5 files changed

+32
-19
lines changed

filestack/__init__.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
11
__version__ = '3.0.1'
2+
3+
4+
class CFG:
5+
API_URL = 'https://www.filestackapi.com/api'
6+
DEFAULT_CHUNK_SIZE = 5 * 1024 ** 2
7+
DEFAULT_UPLOAD_MIMETYPE = 'application/octet-stream'
8+
9+
HEADERS = {
10+
'User-Agent': 'filestack-python {}'.format(__version__),
11+
'Filestack-Source': 'Python-{}'.format(__version__)
12+
}
13+
14+
def __init__(self):
15+
self.CNAME = ''
16+
17+
@property
18+
def CDN_URL(self):
19+
return 'https://{}'.format(self.CNAME or 'cdn.filestackcontent.com')
20+
21+
@property
22+
def MULTIPART_START_URL(self):
23+
return 'https://upload.{}/multipart/start'.format(
24+
self.CNAME or 'filestackapi.com'
25+
)
26+
27+
28+
config = CFG()
29+
30+
231
from .models.client import Client
332
from .models.filelink import Filelink
433
from .models.security import Security

filestack/config.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

filestack/models/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Client:
2525
def __init__(self, apikey, storage='S3', security=None):
2626
"""
2727
Args:
28-
apikey (str): The path of the file to wrap
28+
apikey (str): your Filestack API key
2929
storage (str): default storage to be used for uploads (one of S3, `gcs`, dropbox, azure)
3030
security (:class:`filestack.Security`): Security object that will be used by default
3131
for all API calls

filestack/uploads/multipart.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def bytes(self):
3333

3434

3535
def multipart_request(url, payload, params=None, security=None):
36-
3736
for key in ('path', 'location', 'region', 'container', 'access'):
3837
if key in params:
3938
payload['store'][key] = params[key]

tests/multipart_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from tests.helpers import DummyHttpResponse
1010
from filestack import Client
11-
from filestack.config import MULTIPART_START_URL
11+
from filestack import config
1212
from filestack.uploads.multipart import upload_chunk, Chunk
1313

1414
APIKEY = 'APIKEY'
@@ -27,7 +27,7 @@ def test_upload_filepath():
2727

2828
# add the different HTTP responses that are called during the multipart upload
2929
responses.add(
30-
responses.POST, MULTIPART_START_URL, status=200, content_type='application/json',
30+
responses.POST, config.MULTIPART_START_URL, status=200, content_type='application/json',
3131
json={'region': 'us-east-1', 'upload_id': 'someuuid', 'uri': 'someuri', 'location_url': 'fs-uploads.com'}
3232
)
3333
responses.add(

0 commit comments

Comments
 (0)