Skip to content

Commit 4a7a3f3

Browse files
authored
Merge pull request #32 from dynata/bugfix/post-release-issues-1.0
Post-release issues v 1.0
2 parents 1da7eb6 + c41ce86 commit 4a7a3f3

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

dynatademand/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _api_post(self, uri, payload):
4545
self._check_authentication()
4646
url = '{}{}'.format(self.base_url, uri)
4747
request_headers = {
48-
'oauth_access_token': self._access_token,
48+
'Authorization': 'Bearer {}'.format(self._access_token),
4949
'Content-Type': "application/json",
5050
}
5151
response = requests.post(url=url, json=payload, headers=request_headers)
@@ -60,7 +60,7 @@ def _api_get(self, uri, query_params=None):
6060
self._check_authentication()
6161
url = '{}{}'.format(self.base_url, uri)
6262
request_headers = {
63-
'oauth_access_token': self._access_token,
63+
'Authorization': 'Bearer {}'.format(self._access_token),
6464
'Content-Type': "application/json",
6565
}
6666
response = requests.get(url=url, params=query_params, headers=request_headers)

dynatademand/validator.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import jsonschema
3+
import pkg_resources
34

45
ENDPOINTS = {
56
# Authorization
@@ -57,10 +58,18 @@ def __init__(self, ):
5758
'query': {},
5859
'body': {},
5960
}
61+
resource_package = __name__
6062
for endpoint_name, schemas in ENDPOINTS.items():
6163
for schema in schemas:
62-
with open('dynatademand/schemas/request/{}/{}.json'.format(schema, endpoint_name), 'r') as schema_file:
63-
self.schemas[schema][endpoint_name] = json.load(schema_file)
64+
resource_path = '/'.join((
65+
'schemas',
66+
'request',
67+
schema,
68+
'{}.json'.format(endpoint_name)
69+
))
70+
self.schemas[schema][endpoint_name] = json.loads(
71+
pkg_resources.resource_string(resource_package, resource_path).decode('utf-8')
72+
)
6473

6574
def _validate_object(self, schema_type, endpoint_name, data):
6675
jsonschema.validate(schema=self.schemas[schema_type][endpoint_name], instance=data)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "dynatademand"
3-
version = "1.0"
3+
version = "1.01"
44
description = "A Python client library for the Dynata Demand API"
55
authors = ["Ridley Larsen <Ridley.Larsen@dynata.com>", "Bradley Wogsland <Bradley.Wogsland@dynata.com>", "Nathan Workman <Nathan.Workman@dynata.com>"]
66

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='dynata-demandapi-client',
5-
version=1.0,
5+
version=1.01,
66
license="MIT",
77
description="A Python client library for the Dynata Demand API",
88
long_description="A Python client library for the Dynata Demand API",

0 commit comments

Comments
 (0)