Skip to content

Commit 026bc06

Browse files
committed
initial commit
0 parents  commit 026bc06

13 files changed

+2148
-0
lines changed

Diff for: .gitignore

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# ignore all . files and . folders
2+
# Dont ignore .gitignore (this file)
3+
# This is just for verbosity, you can leave it out if
4+
# .gitignore is already tracked or if you use -f to
5+
# force-add it if you just created it
6+
!/.gitignore
7+
__pycache__/
8+
*.py[cod]
9+
10+
# Distribution / packaging
11+
.Python
12+
env/
13+
build/
14+
.build/
15+
.dist/
16+
.idea/
17+
.marketsight/
18+
develop-eggs/
19+
dist/
20+
downloads/
21+
eggs/
22+
.eggs/
23+
lib/
24+
lib64/
25+
parts/
26+
sdist/
27+
var/
28+
wheels/
29+
*.egg-info/
30+
.installed.cfg
31+
*.egg
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.coverage
47+
.coverage.*
48+
.cache
49+
nosetests.xml
50+
coverage.xml
51+
*.cover
52+
.hypothesis/
53+
tests/.consistency.*
54+
tests/.timing.*
55+
tests/.api_benchmarks.*
56+
tests/pytest.ini
57+
.pytest_cache/*
58+
tests/.pytest_cache/*
59+
60+
# Translations
61+
*.mo
62+
*.pot
63+
64+
# Django stuff:
65+
*.log
66+
local_settings.py
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
target/
80+
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# pyenv
85+
.python-version
86+
87+
# celery beat schedule file
88+
celerybeat-schedule
89+
90+
# SageMath parsed files
91+
*.sage.py
92+
93+
# dotenv
94+
.env
95+
96+
# virtualenv
97+
.venv
98+
venv/
99+
.python27
100+
.py38
101+
.clean
102+
ENV/
103+
.activate.ps1
104+
.pyinstaller27/
105+
.pyinstaller36/
106+
107+
# Spyder project settings
108+
.spyderproject
109+
.spyproject
110+
111+
# Rope project settings
112+
.ropeproject
113+
114+
# mkdocs documentation
115+
/site
116+
117+
# mypy
118+
.mypy_cache/
119+
120+
# docker
121+
.docker/
122+
123+
# deployment scripts
124+
build-deploy*.ps1
125+
/.marketsight/

Diff for: CHANGES.rst

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Release 0.1.0 (released TBD)
2+
=========================================
3+
4+
* First public release

Diff for: LICENSE

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright 2021 Dynata, LLC.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to use,
6+
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7+
Software, and to permit persons to whom the Software is furnished to do so,
8+
subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Diff for: README.rst

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
####################################################
2+
Dynata Reporting & Analytics API
3+
####################################################
4+
5+
.. image:: https://marketsight.readthedocs.io/en/latest/_static/marketsight-logo.png
6+
:alt: Dynata Reporting & Analytics
7+
:align: right
8+
:width: 120
9+
:height: 120
10+
:target: https://marketsight.readthedocs.io/en/latest.html
11+
12+
**Python bindings for the Dynata Reporting & Analytics (MarketSight) API**
13+
14+
15+
The **MarketSight Client API** library provides Python bindings for the
16+
Dynata Reporting & Analytics API, providing a Pythonic interface for
17+
interacting with the underlying platform's RESTful APIs.
18+
19+
.. contents::
20+
:depth: 3
21+
:backlinks: entry
22+
23+
------------------------
24+
25+
*****************
26+
Installation
27+
*****************
28+
29+
To install **MarketSight API Client**, just execute:
30+
31+
.. code:: bash
32+
33+
$ pip install marketsight
34+
35+
Dependencies
36+
=================
37+
38+
* `Validator-Collection v.1.5.0 <https://github.com/insightindustry/validator-collection>`_ or higher
39+
* `simplejson v.3.0 <https://github.com/simplejson/simplejson>`_ or higher
40+
* `bravado v.10.6.0 <https://github.com/Yelp/bravado/>`_ or higher
41+
* `dpath v.2.0.1 <https://github.com/akesterson/dpath-python>`_ or higher
42+
43+
-----------------------------------
44+
45+
*********************************
46+
Key MarketSight API Features
47+
*********************************
48+
49+
* Ability to manage your Account settings within the Dynata Reporting
50+
& Analytics platform.
51+
* Ability to manage data within the Dynata Reporting & Analytics platform.
52+
* Ability to perform high-end statistical analyses on your data in the
53+
Dynata Reporting & Analytics platform.
54+
* Ability to produce interactive visualizations of your data and insights.
55+
* Ability to produce and share interactive dashboards to deliver your insights
56+
to downstream users.
57+
* Ability to embed or otherwise integrate the MarketSight platform into your
58+
applications.
59+
60+
-----------------------
61+
62+
**********************************
63+
Hello, World and Basic Usage
64+
**********************************
65+
66+
1. Initialize the Library
67+
==========================================
68+
69+
70+
.. code-block:: python
71+
:linenos:
72+
73+
74+
# Import the MarketSight API Client
75+
import marketsight
76+
77+
# Call the "client" factory function.
78+
api = marketsight.client("https://application.marketsight.com/api/v1/swagger/public.json")
79+
80+
81+
2. Authorize Against the API
82+
================================
83+
84+
85+
.. code-block:: python
86+
:linenos:
87+
88+
# Initialize the MarketSight API Client.
89+
api = marketsight.client("https://application.marketsight.com/api/v1/swagger/public.json")
90+
91+
# Connect your instance to the API and authorize as a partner.
92+
api.connect(
93+
client_id = "MY CLIENT ID GOES HERE",
94+
client_secret = "MY CLIENT SECRET GOES HERE"
95+
)
96+
97+
3. Call the API
98+
=====================
99+
100+
Execute API calls to perform operations, for example:
101+
102+
103+
.. code-block:: python
104+
:linenos:
105+
106+
107+
# Retrieve an Account
108+
account = api.Accounts.retrieve(account_id = "MY ACCOUNT ID GOES HERE")
109+
110+
# Retrieve a User
111+
user = api.Users.retrieve(user_id = "MY USER ID GOES HERE")
112+
113+
# Retrieve a Dataset's Meta-data
114+
dataset = api.Datasets.retrieve(dataset_id = "MY DATASET ID GOES HERE")
115+
116+
---------------
117+
118+
*********************
119+
Questions and Issues
120+
*********************
121+
122+
You can ask questions and report issues on the project's
123+
`Github Issues Page <https://github.com/dynata/msight-csl/issues>`_
124+
125+
126+
--------------------
127+
128+
**********************
129+
License
130+
**********************
131+
132+
**MarketSight Core** is made available under an
133+
`MIT License <https://marketsight.readthedocs.org/en/latest/license.html>`_.

Diff for: marketsight/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from marketsight.application_api import client, Helper, OPENAPI_URL

Diff for: marketsight/__version__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.1.0"

Diff for: marketsight/_compat.py

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
"""
2+
######################
3+
marketsight._compat
4+
######################
5+
6+
This module handles import compatibility issues between Python 2 and Python 3.
7+
"""
8+
# pylint: disable=invalid-name,redefined-builtin,no-member,missing-docstring,unused-import,undefined-variable,used-before-assignment
9+
10+
import math
11+
import sys
12+
from decimal import Decimal
13+
14+
import chardet
15+
16+
_ver = sys.version_info
17+
18+
#: Python 2.x?
19+
is_py2 = _ver[0] == 2
20+
21+
#: Python 3.x?
22+
is_py3 = _ver[0] == 3
23+
24+
try:
25+
import simplejson as json
26+
except ImportError:
27+
import json
28+
29+
# ---------
30+
# Specifics
31+
# ---------
32+
33+
if is_py2:
34+
from StringIO import StringIO # pylint: disable=import-error
35+
from urllib3.packages.ordered_dict import (
36+
OrderedDict,
37+
) # pylint: disable=import-error,E0611
38+
import urllib as base_urllib
39+
40+
builtin_str = str
41+
bytes = str
42+
str = unicode
43+
basestring = basestring
44+
numeric_types = (int, long, float, Decimal)
45+
integer_types = (int, long)
46+
long = long
47+
xrange = xrange
48+
INFINITY = float("+inf")
49+
NEGATIVE_INFINITY = float("-inf")
50+
51+
52+
elif is_py3:
53+
from io import StringIO
54+
from collections import OrderedDict
55+
import urllib.parse as base_urllib
56+
57+
builtin_str = str
58+
str = str
59+
bytes = bytes
60+
basestring = (str, bytes)
61+
numeric_types = (int, float, Decimal)
62+
integer_types = (int,)
63+
long = int
64+
xrange = range
65+
INFINITY = math.inf
66+
NEGATIVE_INFINITY = -math.inf
67+
68+
69+
def with_metaclass(meta, *bases):
70+
"""Create a base class with a metaclass."""
71+
# This requires a bit of explanation: the basic idea is to make a dummy
72+
# metaclass for one level of class instantiation that replaces itself with
73+
# the actual metaclass.
74+
class metaclass(type):
75+
# pylint: disable=unused-argument
76+
77+
def __new__(cls, name, this_bases, d):
78+
return meta(name, bases, d)
79+
80+
@classmethod
81+
def __prepare__(cls, name, this_bases):
82+
return meta.__prepare__(name, bases)
83+
84+
return type.__new__(metaclass, "temporary_class", (), {})
85+
86+
87+
def add_metaclass(metaclass):
88+
"""Class decorator for creating a class with a metaclass."""
89+
90+
def wrapper(cls):
91+
orig_vars = cls.__dict__.copy()
92+
slots = orig_vars.get("__slots__")
93+
if slots is not None:
94+
if isinstance(slots, str):
95+
slots = [slots]
96+
for slots_var in slots:
97+
orig_vars.pop(slots_var)
98+
orig_vars.pop("__dict__", None)
99+
orig_vars.pop("__weakref__", None)
100+
101+
return metaclass(cls.__name__, cls.__bases__, orig_vars)
102+
103+
return wrapper

0 commit comments

Comments
 (0)