├── docs
├── _build
│ ├── html
│ │ ├── .nojekyll
│ │ ├── _sources
│ │ │ ├── readme.rst.txt
│ │ │ ├── modules.rst.txt
│ │ │ ├── index.rst.txt
│ │ │ └── ticketpy.rst.txt
│ │ ├── _static
│ │ │ ├── custom.css
│ │ │ ├── down.png
│ │ │ ├── file.png
│ │ │ ├── plus.png
│ │ │ ├── up.png
│ │ │ ├── minus.png
│ │ │ ├── comment.png
│ │ │ ├── ajax-loader.gif
│ │ │ ├── up-pressed.png
│ │ │ ├── comment-bright.png
│ │ │ ├── comment-close.png
│ │ │ ├── down-pressed.png
│ │ │ ├── pygments.css
│ │ │ ├── classic.css
│ │ │ ├── sidebar.js
│ │ │ ├── doctools.js
│ │ │ ├── underscore.js
│ │ │ ├── basic.css
│ │ │ ├── alabaster.css
│ │ │ └── searchtools.js
│ │ ├── objects.inv
│ │ ├── .buildinfo
│ │ ├── search.html
│ │ ├── modules.html
│ │ ├── py-modindex.html
│ │ ├── index.html
│ │ ├── searchindex.js
│ │ └── genindex.html
│ └── doctrees
│ │ ├── index.doctree
│ │ ├── readme.doctree
│ │ ├── modules.doctree
│ │ ├── ticketpy.doctree
│ │ └── environment.pickle
├── readme.rst
├── index.rst
├── ticketpy.rst
├── Makefile
├── make.bat
└── conf.py
├── ticketpy
├── tests
│ ├── __init__.py
│ ├── config.ini-example
│ └── test_ticketpy.py
├── __init__.py
├── client.py
├── query.py
└── model.py
├── setup.py
├── LICENSE
├── .gitignore
└── README.rst
/docs/_build/html/.nojekyll:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ticketpy/tests/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/readme.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../README.rst
--------------------------------------------------------------------------------
/docs/_build/html/_sources/readme.rst.txt:
--------------------------------------------------------------------------------
1 | .. include:: ../README.rst
--------------------------------------------------------------------------------
/ticketpy/tests/config.ini-example:
--------------------------------------------------------------------------------
1 | [ticketmaster]
2 | api_key: yourapikey
--------------------------------------------------------------------------------
/docs/_build/html/_static/custom.css:
--------------------------------------------------------------------------------
1 | /* This file intentionally left blank. */
2 |
--------------------------------------------------------------------------------
/docs/_build/html/objects.inv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/objects.inv
--------------------------------------------------------------------------------
/docs/_build/html/_static/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/down.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/file.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/plus.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/up.png
--------------------------------------------------------------------------------
/docs/_build/doctrees/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/doctrees/index.doctree
--------------------------------------------------------------------------------
/docs/_build/doctrees/readme.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/doctrees/readme.doctree
--------------------------------------------------------------------------------
/docs/_build/html/_static/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/minus.png
--------------------------------------------------------------------------------
/docs/_build/doctrees/modules.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/doctrees/modules.doctree
--------------------------------------------------------------------------------
/docs/_build/doctrees/ticketpy.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/doctrees/ticketpy.doctree
--------------------------------------------------------------------------------
/docs/_build/html/_static/comment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/comment.png
--------------------------------------------------------------------------------
/docs/_build/doctrees/environment.pickle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/doctrees/environment.pickle
--------------------------------------------------------------------------------
/docs/_build/html/_sources/modules.rst.txt:
--------------------------------------------------------------------------------
1 | ticketpy
2 | ========
3 |
4 | .. toctree::
5 | :maxdepth: 4
6 |
7 | ticketpy
8 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/ajax-loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/ajax-loader.gif
--------------------------------------------------------------------------------
/docs/_build/html/_static/up-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/up-pressed.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/comment-bright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/comment-bright.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/comment-close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/comment-close.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/down-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arcward/ticketpy/HEAD/docs/_build/html/_static/down-pressed.png
--------------------------------------------------------------------------------
/ticketpy/__init__.py:
--------------------------------------------------------------------------------
1 | __version__ = '1.1.2'
2 | __author__ = 'Edward Wells'
3 | __all__ = ['client', 'model', 'query', 'ApiClient']
4 |
5 | from ticketpy.client import ApiClient
6 |
--------------------------------------------------------------------------------
/docs/_build/html/.buildinfo:
--------------------------------------------------------------------------------
1 | # Sphinx build info version 1
2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3 | config: c1df2d48616edbcbf877ead39ee320c4
4 | tags: 645f666f9bcd5a90fca523b33c5a78b7
5 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. ticketpy documentation master file, created by
2 | sphinx-quickstart on Mon Apr 10 14:52:10 2017.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | Welcome to ticketpy's documentation!
7 | ====================================
8 |
9 | .. toctree::
10 | :maxdepth: 3
11 | :caption: Contents:
12 |
13 | readme
14 | ticketpy
15 |
16 |
17 |
18 | Indices and tables
19 | ==================
20 |
21 | * :ref:`genindex`
22 | * :ref:`modindex`
23 | * :ref:`search`
24 |
--------------------------------------------------------------------------------
/docs/ticketpy.rst:
--------------------------------------------------------------------------------
1 | ticketpy package
2 | ================
3 |
4 | ticketpy\.client module
5 | -------------------------
6 |
7 | .. automodule:: ticketpy.client
8 | :members:
9 | :undoc-members:
10 | :show-inheritance:
11 |
12 | ticketpy\.query module
13 | -------------------------
14 |
15 | .. automodule:: ticketpy.query
16 | :members:
17 | :undoc-members:
18 | :show-inheritance:
19 |
20 | ticketpy\.model module
21 | -------------------------
22 |
23 | .. automodule:: ticketpy.model
24 | :members:
25 | :undoc-members:
26 | :show-inheritance:
27 |
--------------------------------------------------------------------------------
/docs/_build/html/_sources/index.rst.txt:
--------------------------------------------------------------------------------
1 | .. ticketpy documentation master file, created by
2 | sphinx-quickstart on Mon Apr 10 14:52:10 2017.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | Welcome to ticketpy's documentation!
7 | ====================================
8 |
9 | .. toctree::
10 | :maxdepth: 3
11 | :caption: Contents:
12 |
13 | readme
14 | ticketpy
15 |
16 |
17 |
18 | Indices and tables
19 | ==================
20 |
21 | * :ref:`genindex`
22 | * :ref:`modindex`
23 | * :ref:`search`
24 |
--------------------------------------------------------------------------------
/docs/_build/html/_sources/ticketpy.rst.txt:
--------------------------------------------------------------------------------
1 | ticketpy package
2 | ================
3 |
4 | ticketpy\.client module
5 | -------------------------
6 |
7 | .. automodule:: ticketpy.client
8 | :members:
9 | :undoc-members:
10 | :show-inheritance:
11 |
12 | ticketpy\.query module
13 | -------------------------
14 |
15 | .. automodule:: ticketpy.query
16 | :members:
17 | :undoc-members:
18 | :show-inheritance:
19 |
20 | ticketpy\.model module
21 | -------------------------
22 |
23 | .. automodule:: ticketpy.model
24 | :members:
25 | :undoc-members:
26 | :show-inheritance:
27 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 | import os
3 | import ticketpy
4 |
5 |
6 | def read(fname):
7 | return open(os.path.join(os.path.dirname(__file__), fname)).read()
8 |
9 |
10 | setup(
11 | name='ticketpy',
12 | version=ticketpy.__version__,
13 | author=ticketpy.__author__,
14 | author_email='git@edward.sh',
15 | description="Python wrapper/SDK for the Ticketmaster Discovery API",
16 | long_description=read('README.rst'),
17 | license='MIT',
18 | keywords='Ticketmaster',
19 | url='https://github.com/arcward/ticketpy',
20 | packages=['ticketpy'],
21 | install_requires=['requests']
22 | )
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SPHINXPROJ = ticketpy
8 | SOURCEDIR = .
9 | BUILDDIR = _build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=.
11 | set BUILDDIR=_build
12 | set SPHINXPROJ=ticketpy
13 |
14 | if "%1" == "" goto help
15 |
16 | %SPHINXBUILD% >NUL 2>NUL
17 | if errorlevel 9009 (
18 | echo.
19 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
20 | echo.installed, then set the SPHINXBUILD environment variable to point
21 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
22 | echo.may add the Sphinx directory to PATH.
23 | echo.
24 | echo.If you don't have Sphinx installed, grab it from
25 | echo.http://sphinx-doc.org/
26 | exit /b 1
27 | )
28 |
29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
30 | goto end
31 |
32 | :help
33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
34 |
35 | :end
36 | popd
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016/2017 - Edward Wells
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ### Python template
2 | # Byte-compiled / optimized / DLL files
3 | __pycache__/
4 | *.py[cod]
5 | *$py.class
6 |
7 | # C extensions
8 | *.so
9 |
10 | # Distribution / packaging
11 | .Python
12 | develop-eggs/
13 | downloads/
14 | eggs/
15 | .eggs/
16 | lib/
17 | lib64/
18 | parts/
19 | sdist/
20 | var/
21 | wheels/
22 | *.egg-info/
23 | .installed.cfg
24 | *.egg
25 | MANIFEST
26 |
27 | # PyInstaller
28 | # Usually these files are written by a python script from a template
29 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
30 | *.manifest
31 | *.spec
32 |
33 | # Installer logs
34 | pip-log.txt
35 | pip-delete-this-directory.txt
36 |
37 | # Unit test / coverage reports
38 | htmlcov/
39 | .tox/
40 | .coverage
41 | .coverage.*
42 | .cache
43 | nosetests.xml
44 | coverage.xml
45 | *.cover
46 | .hypothesis/
47 |
48 | # Translations
49 | *.mo
50 | *.pot
51 |
52 | # Django stuff:
53 | *.log
54 | .static_storage/
55 | .media/
56 | local_settings.py
57 |
58 | # Flask stuff:
59 | instance/
60 | .webassets-cache
61 |
62 | # Scrapy stuff:
63 | .scrapy
64 |
65 | # Sphinx documentation
66 | docs/_build/
67 |
68 | # PyBuilder
69 | target/
70 |
71 | # Jupyter Notebook
72 | .ipynb_checkpoints
73 |
74 | # pyenv
75 | .python-version
76 |
77 | # celery beat schedule file
78 | celerybeat-schedule
79 |
80 | # SageMath parsed files
81 | *.sage.py
82 |
83 | # Environments
84 | .env
85 | .venv
86 | env/
87 | venv/
88 | ENV/
89 | env.bak/
90 | venv.bak/
91 |
92 | # Spyder project settings
93 | .spyderproject
94 | .spyproject
95 |
96 | # Rope project settings
97 | .ropeproject
98 |
99 | # mkdocs documentation
100 | /site
101 |
102 | # mypy
103 | .mypy_cache/
104 |
105 | config.ini
106 | .idea
107 | build/
108 | dist/
109 | ticketpy.egg-info
110 | *.pyc
111 | *.pickle
112 | ticketpy/__pycache__/
113 | coverage/
114 |
115 |
--------------------------------------------------------------------------------
/docs/_build/html/search.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | Search — ticketpy 1.1.1 documentation
9 |
10 |
11 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
Search
55 |
56 |
57 |
58 | Please activate JavaScript to enable the search
59 | functionality.
60 |
61 |
62 |
63 | From here you can search these documents. Enter your search
64 | words into the box below and click "search". Note that the search
65 | function will automatically search for all of the words. Pages
66 | containing fewer words won't appear in the result list.
67 |
68 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
85 |
86 |
87 |
99 |
103 |
104 |
--------------------------------------------------------------------------------
/docs/_build/html/modules.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | ticketpy — ticketpy 1.0.5 documentation
10 |
11 |
12 |
13 |
14 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
43 |
44 |
90 |
102 |
106 |
107 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/pygments.css:
--------------------------------------------------------------------------------
1 | .highlight .hll { background-color: #ffffcc }
2 | .highlight { background: #eeffcc; }
3 | .highlight .c { color: #408090; font-style: italic } /* Comment */
4 | .highlight .err { border: 1px solid #FF0000 } /* Error */
5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */
6 | .highlight .o { color: #666666 } /* Operator */
7 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
8 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
9 | .highlight .cp { color: #007020 } /* Comment.Preproc */
10 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
11 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
12 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */
14 | .highlight .ge { font-style: italic } /* Generic.Emph */
15 | .highlight .gr { color: #FF0000 } /* Generic.Error */
16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */
18 | .highlight .go { color: #333333 } /* Generic.Output */
19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
20 | .highlight .gs { font-weight: bold } /* Generic.Strong */
21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */
23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */
27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
28 | .highlight .kt { color: #902000 } /* Keyword.Type */
29 | .highlight .m { color: #208050 } /* Literal.Number */
30 | .highlight .s { color: #4070a0 } /* Literal.String */
31 | .highlight .na { color: #4070a0 } /* Name.Attribute */
32 | .highlight .nb { color: #007020 } /* Name.Builtin */
33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
34 | .highlight .no { color: #60add5 } /* Name.Constant */
35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
37 | .highlight .ne { color: #007020 } /* Name.Exception */
38 | .highlight .nf { color: #06287e } /* Name.Function */
39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */
43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */
45 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */
46 | .highlight .mf { color: #208050 } /* Literal.Number.Float */
47 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */
48 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */
49 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */
50 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */
51 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
52 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */
53 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */
54 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
55 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */
56 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
57 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
58 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
59 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */
60 | .highlight .sr { color: #235388 } /* Literal.String.Regex */
61 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */
62 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */
63 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
64 | .highlight .fm { color: #06287e } /* Name.Function.Magic */
65 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
66 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
67 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
68 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
69 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
--------------------------------------------------------------------------------
/docs/_build/html/py-modindex.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | Python Module Index — ticketpy 1.1.1 documentation
9 |
10 |
11 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
Python Module Index
51 |
52 |
55 |
56 |
82 |
83 |
84 |
85 |
86 |
87 |
101 |
102 |
103 |
115 |
119 |
120 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/classic.css:
--------------------------------------------------------------------------------
1 | /*
2 | * classic.css_t
3 | * ~~~~~~~~~~~~~
4 | *
5 | * Sphinx stylesheet -- classic theme.
6 | *
7 | * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | @import url("basic.css");
13 |
14 | /* -- page layout ----------------------------------------------------------- */
15 |
16 | body {
17 | font-family: sans-serif;
18 | font-size: 100%;
19 | background-color: #11303d;
20 | color: #000;
21 | margin: 0;
22 | padding: 0;
23 | }
24 |
25 | div.document {
26 | background-color: #1c4e63;
27 | }
28 |
29 | div.documentwrapper {
30 | float: left;
31 | width: 100%;
32 | }
33 |
34 | div.bodywrapper {
35 | margin: 0 0 0 230px;
36 | }
37 |
38 | div.body {
39 | background-color: #ffffff;
40 | color: #000000;
41 | padding: 0 20px 30px 20px;
42 | }
43 |
44 | div.footer {
45 | color: #ffffff;
46 | width: 100%;
47 | padding: 9px 0 9px 0;
48 | text-align: center;
49 | font-size: 75%;
50 | }
51 |
52 | div.footer a {
53 | color: #ffffff;
54 | text-decoration: underline;
55 | }
56 |
57 | div.related {
58 | background-color: #133f52;
59 | line-height: 30px;
60 | color: #ffffff;
61 | }
62 |
63 | div.related a {
64 | color: #ffffff;
65 | }
66 |
67 | div.sphinxsidebar {
68 | }
69 |
70 | div.sphinxsidebar h3 {
71 | font-family: 'Trebuchet MS', sans-serif;
72 | color: #ffffff;
73 | font-size: 1.4em;
74 | font-weight: normal;
75 | margin: 0;
76 | padding: 0;
77 | }
78 |
79 | div.sphinxsidebar h3 a {
80 | color: #ffffff;
81 | }
82 |
83 | div.sphinxsidebar h4 {
84 | font-family: 'Trebuchet MS', sans-serif;
85 | color: #ffffff;
86 | font-size: 1.3em;
87 | font-weight: normal;
88 | margin: 5px 0 0 0;
89 | padding: 0;
90 | }
91 |
92 | div.sphinxsidebar p {
93 | color: #ffffff;
94 | }
95 |
96 | div.sphinxsidebar p.topless {
97 | margin: 5px 10px 10px 10px;
98 | }
99 |
100 | div.sphinxsidebar ul {
101 | margin: 10px;
102 | padding: 0;
103 | color: #ffffff;
104 | }
105 |
106 | div.sphinxsidebar a {
107 | color: #98dbcc;
108 | }
109 |
110 | div.sphinxsidebar input {
111 | border: 1px solid #98dbcc;
112 | font-family: sans-serif;
113 | font-size: 1em;
114 | }
115 |
116 |
117 |
118 | /* -- hyperlink styles ------------------------------------------------------ */
119 |
120 | a {
121 | color: #355f7c;
122 | text-decoration: none;
123 | }
124 |
125 | a:visited {
126 | color: #355f7c;
127 | text-decoration: none;
128 | }
129 |
130 | a:hover {
131 | text-decoration: underline;
132 | }
133 |
134 |
135 |
136 | /* -- body styles ----------------------------------------------------------- */
137 |
138 | div.body h1,
139 | div.body h2,
140 | div.body h3,
141 | div.body h4,
142 | div.body h5,
143 | div.body h6 {
144 | font-family: 'Trebuchet MS', sans-serif;
145 | background-color: #f2f2f2;
146 | font-weight: normal;
147 | color: #20435c;
148 | border-bottom: 1px solid #ccc;
149 | margin: 20px -20px 10px -20px;
150 | padding: 3px 0 3px 10px;
151 | }
152 |
153 | div.body h1 { margin-top: 0; font-size: 200%; }
154 | div.body h2 { font-size: 160%; }
155 | div.body h3 { font-size: 140%; }
156 | div.body h4 { font-size: 120%; }
157 | div.body h5 { font-size: 110%; }
158 | div.body h6 { font-size: 100%; }
159 |
160 | a.headerlink {
161 | color: #c60f0f;
162 | font-size: 0.8em;
163 | padding: 0 4px 0 4px;
164 | text-decoration: none;
165 | }
166 |
167 | a.headerlink:hover {
168 | background-color: #c60f0f;
169 | color: white;
170 | }
171 |
172 | div.body p, div.body dd, div.body li, div.body blockquote {
173 | text-align: justify;
174 | line-height: 130%;
175 | }
176 |
177 | div.admonition p.admonition-title + p {
178 | display: inline;
179 | }
180 |
181 | div.admonition p {
182 | margin-bottom: 5px;
183 | }
184 |
185 | div.admonition pre {
186 | margin-bottom: 5px;
187 | }
188 |
189 | div.admonition ul, div.admonition ol {
190 | margin-bottom: 5px;
191 | }
192 |
193 | div.note {
194 | background-color: #eee;
195 | border: 1px solid #ccc;
196 | }
197 |
198 | div.seealso {
199 | background-color: #ffc;
200 | border: 1px solid #ff6;
201 | }
202 |
203 | div.topic {
204 | background-color: #eee;
205 | }
206 |
207 | div.warning {
208 | background-color: #ffe4e4;
209 | border: 1px solid #f66;
210 | }
211 |
212 | p.admonition-title {
213 | display: inline;
214 | }
215 |
216 | p.admonition-title:after {
217 | content: ":";
218 | }
219 |
220 | pre {
221 | padding: 5px;
222 | background-color: #eeffcc;
223 | color: #333333;
224 | line-height: 120%;
225 | border: 1px solid #ac9;
226 | border-left: none;
227 | border-right: none;
228 | }
229 |
230 | code {
231 | background-color: #ecf0f3;
232 | padding: 0 1px 0 1px;
233 | font-size: 0.95em;
234 | }
235 |
236 | th {
237 | background-color: #ede;
238 | }
239 |
240 | .warning code {
241 | background: #efc2c2;
242 | }
243 |
244 | .note code {
245 | background: #d6d6d6;
246 | }
247 |
248 | .viewcode-back {
249 | font-family: sans-serif;
250 | }
251 |
252 | div.viewcode-block:target {
253 | background-color: #f4debf;
254 | border-top: 1px solid #ac9;
255 | border-bottom: 1px solid #ac9;
256 | }
257 |
258 | div.code-block-caption {
259 | color: #efefef;
260 | background-color: #1c4e63;
261 | }
--------------------------------------------------------------------------------
/docs/_build/html/_static/sidebar.js:
--------------------------------------------------------------------------------
1 | /*
2 | * sidebar.js
3 | * ~~~~~~~~~~
4 | *
5 | * This script makes the Sphinx sidebar collapsible.
6 | *
7 | * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds
8 | * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton
9 | * used to collapse and expand the sidebar.
10 | *
11 | * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden
12 | * and the width of the sidebar and the margin-left of the document
13 | * are decreased. When the sidebar is expanded the opposite happens.
14 | * This script saves a per-browser/per-session cookie used to
15 | * remember the position of the sidebar among the pages.
16 | * Once the browser is closed the cookie is deleted and the position
17 | * reset to the default (expanded).
18 | *
19 | * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
20 | * :license: BSD, see LICENSE for details.
21 | *
22 | */
23 |
24 | $(function() {
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | // global elements used by the functions.
34 | // the 'sidebarbutton' element is defined as global after its
35 | // creation, in the add_sidebar_button function
36 | var bodywrapper = $('.bodywrapper');
37 | var sidebar = $('.sphinxsidebar');
38 | var sidebarwrapper = $('.sphinxsidebarwrapper');
39 |
40 | // for some reason, the document has no sidebar; do not run into errors
41 | if (!sidebar.length) return;
42 |
43 | // original margin-left of the bodywrapper and width of the sidebar
44 | // with the sidebar expanded
45 | var bw_margin_expanded = bodywrapper.css('margin-left');
46 | var ssb_width_expanded = sidebar.width();
47 |
48 | // margin-left of the bodywrapper and width of the sidebar
49 | // with the sidebar collapsed
50 | var bw_margin_collapsed = '.8em';
51 | var ssb_width_collapsed = '.8em';
52 |
53 | // colors used by the current theme
54 | var dark_color = $('.related').css('background-color');
55 | var light_color = $('.document').css('background-color');
56 |
57 | function sidebar_is_collapsed() {
58 | return sidebarwrapper.is(':not(:visible)');
59 | }
60 |
61 | function toggle_sidebar() {
62 | if (sidebar_is_collapsed())
63 | expand_sidebar();
64 | else
65 | collapse_sidebar();
66 | }
67 |
68 | function collapse_sidebar() {
69 | sidebarwrapper.hide();
70 | sidebar.css('width', ssb_width_collapsed);
71 | bodywrapper.css('margin-left', bw_margin_collapsed);
72 | sidebarbutton.css({
73 | 'margin-left': '0',
74 | 'height': bodywrapper.height()
75 | });
76 | sidebarbutton.find('span').text('»');
77 | sidebarbutton.attr('title', _('Expand sidebar'));
78 | document.cookie = 'sidebar=collapsed';
79 | }
80 |
81 | function expand_sidebar() {
82 | bodywrapper.css('margin-left', bw_margin_expanded);
83 | sidebar.css('width', ssb_width_expanded);
84 | sidebarwrapper.show();
85 | sidebarbutton.css({
86 | 'margin-left': ssb_width_expanded-12,
87 | 'height': bodywrapper.height()
88 | });
89 | sidebarbutton.find('span').text('«');
90 | sidebarbutton.attr('title', _('Collapse sidebar'));
91 | document.cookie = 'sidebar=expanded';
92 | }
93 |
94 | function add_sidebar_button() {
95 | sidebarwrapper.css({
96 | 'float': 'left',
97 | 'margin-right': '0',
98 | 'width': ssb_width_expanded - 28
99 | });
100 | // create the button
101 | sidebar.append(
102 | ''
103 | );
104 | var sidebarbutton = $('#sidebarbutton');
105 | light_color = sidebarbutton.css('background-color');
106 | // find the height of the viewport to center the '<<' in the page
107 | var viewport_height;
108 | if (window.innerHeight)
109 | viewport_height = window.innerHeight;
110 | else
111 | viewport_height = $(window).height();
112 | sidebarbutton.find('span').css({
113 | 'display': 'block',
114 | 'margin-top': (viewport_height - sidebar.position().top - 20) / 2
115 | });
116 |
117 | sidebarbutton.click(toggle_sidebar);
118 | sidebarbutton.attr('title', _('Collapse sidebar'));
119 | sidebarbutton.css({
120 | 'color': '#FFFFFF',
121 | 'border-left': '1px solid ' + dark_color,
122 | 'font-size': '1.2em',
123 | 'cursor': 'pointer',
124 | 'height': bodywrapper.height(),
125 | 'padding-top': '1px',
126 | 'margin-left': ssb_width_expanded - 12
127 | });
128 |
129 | sidebarbutton.hover(
130 | function () {
131 | $(this).css('background-color', dark_color);
132 | },
133 | function () {
134 | $(this).css('background-color', light_color);
135 | }
136 | );
137 | }
138 |
139 | function set_position_from_cookie() {
140 | if (!document.cookie)
141 | return;
142 | var items = document.cookie.split(';');
143 | for(var k=0; k
4 |
5 |
6 |
7 |
8 | Welcome to ticketpy’s documentation! — ticketpy 1.1.1 documentation
9 |
10 |
11 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
Welcome to ticketpy’s documentation!
52 |
75 |
76 |
77 |
Indices and tables
78 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
119 |
120 |
121 |
136 |
140 |
141 |
--------------------------------------------------------------------------------
/docs/_build/html/searchindex.js:
--------------------------------------------------------------------------------
1 | Search.setIndex({docnames:["index","readme","ticketpy"],envversion:53,filenames:["index.rst","readme.rst","ticketpy.rst"],objects:{"ticketpy.client":{ApiClient:[2,1,1,""],ApiException:[2,4,1,""],PagedResponse:[2,1,1,""]},"ticketpy.client.ApiClient":{api_key:[2,2,1,""],get_url:[2,3,1,""],root_url:[2,2,1,""],search:[2,3,1,""],url:[2,2,1,""]},"ticketpy.client.PagedResponse":{all:[2,3,1,""],limit:[2,3,1,""],one:[2,3,1,""]},"ticketpy.model":{Attraction:[2,1,1,""],Classification:[2,1,1,""],ClassificationSubType:[2,1,1,""],ClassificationType:[2,1,1,""],Event:[2,1,1,""],EventClassification:[2,1,1,""],Genre:[2,1,1,""],Page:[2,1,1,""],Segment:[2,1,1,""],SubGenre:[2,1,1,""],Venue:[2,1,1,""]},"ticketpy.model.Attraction":{from_json:[2,5,1,""]},"ticketpy.model.Classification":{from_json:[2,5,1,""]},"ticketpy.model.Event":{from_json:[2,5,1,""],local_start_date:[2,2,1,""],local_start_time:[2,2,1,""],status:[2,2,1,""],utc_datetime:[2,2,1,""]},"ticketpy.model.EventClassification":{from_json:[2,5,1,""]},"ticketpy.model.Genre":{from_json:[2,5,1,""]},"ticketpy.model.Page":{from_json:[2,5,1,""]},"ticketpy.model.Segment":{from_json:[2,5,1,""]},"ticketpy.model.SubGenre":{from_json:[2,5,1,""]},"ticketpy.model.Venue":{from_json:[2,5,1,""],location:[2,2,1,""],state_code:[2,2,1,""]},"ticketpy.query":{AttractionQuery:[2,1,1,""],BaseQuery:[2,1,1,""],ClassificationQuery:[2,1,1,""],EventQuery:[2,1,1,""],VenueQuery:[2,1,1,""]},"ticketpy.query.AttractionQuery":{find:[2,3,1,""]},"ticketpy.query.BaseQuery":{attr_map:[2,2,1,""],by_id:[2,3,1,""]},"ticketpy.query.ClassificationQuery":{find:[2,3,1,""],genre_by_id:[2,3,1,""],segment_by_id:[2,3,1,""],subgenre_by_id:[2,3,1,""]},"ticketpy.query.EventQuery":{by_location:[2,3,1,""],find:[2,3,1,""]},"ticketpy.query.VenueQuery":{by_name:[2,3,1,""],find:[2,3,1,""]},ticketpy:{client:[2,0,0,"-"],model:[2,0,0,"-"],query:[2,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","method","Python method"],"4":["py","exception","Python exception"],"5":["py","staticmethod","Python static method"]},objtypes:{"0":"py:module","1":"py:class","2":"py:attribute","3":"py:method","4":"py:exception","5":"py:staticmethod"},terms:{"00z":[1,2],"01t23":2,"19t20":1,"19th":1,"21st":1,"21t20":1,"4th":1,"abstract":2,"class":[1,2],"default":[1,2],"import":[1,2],"new":1,"return":[1,2],"static":2,"true":2,For:[1,2],Not:1,Notting:[1,2],The:[1,2],Use:[1,2],_embed:2,_link:2,abov:1,accessible_seating_detail:2,address:2,all:[1,2],also:1,america:2,amphitheat:1,announc:2,anyth:1,api:[1,2],api_cli:2,api_kei:2,apicli:[1,2],apiexcept:2,apikei:2,app:2,area:2,arg:2,art:1,asc:2,atlanta:[1,2],attr:1,attr_map:2,attract:[0,2],attraction_id:2,attraction_nam:2,attractionid:2,attractionqueri:2,auckland:1,automat:2,avail:1,awai:[1,2],baptist:1,barr:1,base:[1,2],basequeri:2,battl:1,bebop:1,befor:2,behind:1,being:2,bethel:[1,2],between:1,bluff:1,bomber:1,box_office_info:2,breviti:2,buck:1,by_id:[1,2],by_loc:2,by_nam:2,call:1,can:1,cancel:2,center:[1,2],chang:2,charleston:1,church:1,citi:[1,2],classif:[0,2],classification_id:2,classification_nam:[1,2],classification_subtyp:2,classification_typ:2,classificationid:2,classificationnam:2,classificationqueri:2,classificationsubtyp:2,classificationtyp:2,client:0,client_vis:2,clientvis:2,code:2,com:[1,2],content:0,convert:2,coordin:2,could:1,countri:2,country_cod:2,countrycod:2,creat:2,creek:1,criteria:2,dai:1,damn:1,data:2,date:[1,2],ddthh:2,defin:2,desc:2,detail:1,develop:1,directori:1,discoveri:[1,2],dma:2,dma_id:2,dmaid:2,doc:1,drama:1,each:[1,2],edit:2,either:1,element:1,end:2,end_date_tim:[1,2],enddatetim:2,entiti:2,entity_id:2,error:2,etc:2,event:[0,2],event_id:2,eventclassif:2,eventid:2,eventqueri:2,eventsearch:2,everi:1,exampl:[0,2],except:2,exclud:2,expect:2,fals:2,fan:1,far:2,fest:1,film:1,filter:2,find:[1,2],first:[1,2],flag:2,flat:[1,2],format:[1,2],found:2,from:[1,2],from_json:2,frontgat:2,full:2,funk:[1,2],gener:2,general_info:2,genr:[1,2],genre_by_id:2,genre_id:2,genre_nam:2,georgia:[1,2],get:2,get_url:2,given:[1,2],hand:1,handl:2,have:1,here:[1,2],hill:[1,2],hip:1,histori:1,hop:1,howev:1,href:2,http:[1,2],imag:2,includ:2,include_tba:2,include_tbd:2,include_test:2,includetba:2,includetbd:2,includetest:2,index:0,info:1,instal:0,instanti:2,involv:2,island:1,item:2,iter:[1,2],its:2,jazz:1,join:2,json:2,json_ev:2,json_obj:2,json_venu:2,junction:1,just:1,keyword:[1,2],knvzfz7vave:1,kovzpafez:2,kwarg:2,kzazbeonsmnzfz7vkdl:1,kzfzniwnsyzfz7v7nj:1,larg:1,lat:2,latitud:2,latlong:2,least:2,letter:2,like:2,limit:[1,2],line1:2,link:2,list:[1,2],local:[1,2],local_start_d:2,local_start_tim:2,locald:2,localtim:2,locat:2,lon:2,london:1,longitud:2,look:2,loop:1,lot:2,lucki:2,made:2,mai:[1,2],main:2,make:2,map:2,market:2,market_id:2,marketid:2,match:[1,2],max:2,max_pag:2,maximum:1,merk:1,messag:2,method:2,mile:2,min:2,model:[0,1],modul:0,more:1,music:1,name:[1,2],narrow:2,nashvil:1,nest:1,new_york:2,next:1,none:2,number:2,nycfc:1,oak:1,object:[1,2],offsal:2,offsit:1,one:[1,2],onli:2,onsal:[1,2],onsale_end_date_tim:2,onsale_start_date_tim:2,onsaleenddatetim:2,onsalestartdatetim:2,order:2,output:[1,2],outsid:2,packag:0,page:[0,1,2],pagedrespons:[1,2],paramet:2,parent:2,park:1,parking_detail:2,part:2,peachtre:1,pentecost:1,penticton:1,pip:1,postal_cod:2,postalcod:2,previou:1,price:1,price_rang:2,pricerang:2,primari:2,print:[1,2],probabl:1,product:1,promoter_id:2,promoterid:2,provid:2,pull:1,python:1,queri:[0,1],quikpark:1,radiu:2,railrid:1,rang:1,rap:1,rather:2,realli:1,relat:2,relev:2,repres:2,request:[1,2],requir:0,resp:2,respons:[1,2],restrict:2,result:[1,2],retriev:2,revivaltim:[1,2],road:1,rock:2,root_url:2,sale:2,same:1,save:1,scene:1,scranton:1,sdk:1,search:[0,2],see:2,segment:[1,2],segment_by_id:2,segment_id:2,segment_nam:2,segmentid:2,segmentnam:2,serach:2,set:1,setup:1,shoreditch:1,similarli:1,simplifi:1,size:2,social:2,some:1,someth:2,sort:2,sourc:2,specif:2,ssz:2,stadium:1,stage:1,start:[1,2],start_dat:2,start_date_tim:[1,2],start_tim:2,startdatetim:2,state:2,state_cod:[1,2],statecod:2,staten:1,statu:[1,2],street:2,string:1,structur:2,sub:2,subgenr:[1,2],subgenre_by_id:2,subgenre_id:2,subgenre_nam:2,subtyp:2,tabernacl:[1,2],tabernacleatl:2,tampa:1,test:2,than:2,theater:1,theatr:1,thi:[1,2],though:1,through:[1,2],thrown:2,ticket:1,ticketmast:[1,2],time:[1,2],timestamp:2,timezon:2,tm_client:1,tmr:2,toronto:1,total:1,total_el:2,total_pag:2,tour:1,twitter:2,two:2,type:[1,2],type_id:2,type_nam:2,unit:2,univers:2,url:2,use:1,used:2,using:1,utc:2,utc_datetim:2,venu:[0,2],venue_id:2,venue_nam:2,venueid:2,venuequeri:2,via:1,want:1,warn:2,wast:1,what:2,whether:2,which:1,whichev:1,wilk:1,within:2,wolf:1,wonki:2,work:1,would:1,wrapper:[1,2],written:1,www:2,yanke:1,yeovil:1,yes:2,york:1,you:[1,2],your_api_kei:[1,2],yyyi:2},titles:["Welcome to ticketpy\u2019s documentation!","ticketpy","ticketpy package"],titleterms:{attract:1,classif:1,client:2,document:0,event:1,exampl:1,indic:0,instal:1,model:2,modul:2,packag:2,queri:2,requir:1,search:1,tabl:0,ticketpi:[0,1,2],venu:1,welcom:0}})
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | ticketpy
2 | ========
3 |
4 | **Python wrapper/SDK for Ticketmaster's Discovery API**
5 |
6 | More info:
7 | http://developer.ticketmaster.com/products-and-docs/apis/discovery-api/v2/
8 |
9 | Requirements
10 | ------------
11 |
12 | - Python >= 3.5.2 (anything >= 3 is probably OK)
13 | - Requests >= 2.13.0
14 |
15 | Installation
16 | ------------
17 | To install via *pip*:
18 |
19 | .. code-block:: bash
20 |
21 | $ pip install ticketpy
22 |
23 | Or, locally from the same directory as ``setup.py``:
24 |
25 | .. code-block:: bash
26 |
27 | $ python setup.py install
28 |
29 | Example searches
30 | -------------------
31 |
32 | Events
33 | ^^^^^^
34 | To pull all Hip-Hop events in Georgia between May 19th, 2017 and
35 | May 21st, 2017:
36 |
37 | .. code-block:: python
38 |
39 | import ticketpy
40 |
41 | tm_client = ticketpy.ApiClient('your_api_key')
42 |
43 | pages = tm_client.events.find(
44 | classification_name='Hip-Hop',
45 | state_code='GA',
46 | start_date_time='2017-05-19T20:00:00Z',
47 | end_date_time='2017-05-21T20:00:00Z'
48 | )
49 |
50 | for page in pages:
51 | for event in page:
52 | print(event)
53 |
54 | Output::
55 |
56 | Event: Atlanta Funk Fest 2017 3 Day Ticket
57 | Venue(s): 'Wolf Creek Amphitheater' at 3025 Merk Road in Atlanta GA
58 | Start date: 2017-05-19
59 | Start time: 19:00:00
60 | Price ranges: 128.01-424.0
61 | Status: onsale
62 | Genres: R&B
63 |
64 | Event: Atlanta Funk Fest 2017
65 | Venue(s): 'Wolf Creek Amphitheater' at 3025 Merk Road in Atlanta GA
66 | Start date: 2017-05-19
67 | Start time: 19:00:00
68 | Price ranges: 63.0-158.0
69 | Status: onsale
70 | Genres: R&B
71 |
72 | Event: Atlanta Funk Fest 2017
73 | Venue(s): 'Wolf Creek Amphitheater' at 3025 Merk Road in Atlanta GA
74 | Start date: 2017-05-20
75 | Start time: 17:00:00
76 | Price ranges: 63.0-158.0
77 | Status: onsale
78 | Genres: Hip-Hop/Rap
79 |
80 | Event: NF
81 | Venue(s): 'Center Stage Theater' at 1374 W Peachtree St. NW in Atlanta GA
82 | Start date: 2017-05-20
83 | Start time: 20:00:00
84 | Price ranges: 22.0-83.0
85 | Status: onsale
86 | Genres: Hip-Hop/Rap
87 |
88 | Calling ``ApiClient.find()`` returns a ``ticketpy.PagedResponse``
89 | object, which iterates through API response pages (as ``ticketpy.Page``).
90 |
91 | By default, pages have 20 elements. If there are >20 total elements,
92 | calling ``PagedResponse.next()`` will request the next page from the API.
93 |
94 | You can simplify that/do away with the nested loop by using
95 | ``PagedResponse.limit()``. By default, this requests a maximum of 5 pages,
96 | and returns the elements of each in a flat list.
97 |
98 | Use ``PagedResponse.one()`` to return just the list from the first page.
99 |
100 | For example, the previous example could also be written as:
101 |
102 | .. code-block:: python
103 |
104 | import ticketpy
105 |
106 | tm_client = ticketpy.ApiClient('your_api_key')
107 |
108 | pages = tm_client.events.find(
109 | classification_name='Hip-Hop',
110 | state_code='GA',
111 | start_date_time='2017-05-19T20:00:00Z',
112 | end_date_time='2017-05-21T20:00:00Z'
113 | ).limit()
114 |
115 | for event in pages:
116 | print(event)
117 |
118 | The output here would be the same as there was <1 page available, however,
119 | this can save you some wasted API calls for large result sets. If you
120 | really want *every page*, though, use ``all()`` to request every available
121 | page.
122 |
123 | Venues
124 | ^^^^^^
125 | To search for all venues based on the string "*Tabernacle*":
126 |
127 | .. code-block:: python
128 |
129 | import ticketpy
130 |
131 | tm_client = ticketpy.ApiClient("your_api_key")
132 | venues = tm_client.venues.find(keyword="Tabernacle").all()
133 | for v in venues:
134 | print("Name: {} / City: {}".format(v.name, v.city))
135 |
136 | Output::
137 |
138 | Name: Tabernacle / City: London
139 | Name: The Tabernacle / City: Atlanta
140 | Name: Tabernacle, Notting Hill / City: London
141 | Name: Bethel Tabernacle / City: Penticton
142 | Name: Revivaltime Tabernacle / City: Toronto
143 | Name: Auckland Baptist Tabernacle / City: Auckland
144 | Name: Pentecostal Tabernacle / City: Nashville
145 | Name: The Tabernacle / City: Oak Bluffs
146 | Name: Tabernacle, Shoreditch / City: London
147 | Name: Revivaltime Tabernacle / City: Toronto
148 | Name: Tabernacle, Notting Hill / City: London
149 | Name: The Tabernacle / City: London
150 | Name: Tabernacle Junction / City: Yeovil
151 | Name: New Tabernacle 4th Baptist Church / City: Charleston
152 |
153 | Attractions
154 | ^^^^^^^^^^^
155 | Searching for attractions works similarly to the above:
156 |
157 | .. code-block:: python
158 |
159 | import ticketpy
160 |
161 | tm_client = ticketpy.ApiClient("your_api_key")
162 | attractions = tm_client.attractions.find(keyword="Yankees").one()
163 | for attr in attractions:
164 | print(attr.name)
165 |
166 | Output::
167 |
168 | New York Yankees
169 | Scranton Wilkes-Barre RailRiders
170 | Staten Island Yankees
171 | Yankee Stadium Tours
172 | Tampa Yankees
173 | New York Yankees Bomber Bucks
174 | Hands On History At Yankee Stadium
175 | Damn Yankees
176 | Damn Yankees
177 | Battle Creek Yankees
178 | New York Yankees Parking
179 | Offsite Parking at Yankee Stadium
180 | Quikpark at Yankee Stadium- NYCFC
181 | New York Yankees Fan Fest
182 | New York Yankees 3 (Do Not Use)
183 | New York Yankees 1 (Do Not Use)
184 | New York Yankees 2 (Do Not Use)
185 | Behind the Scenes At Yankee Stadium
186 |
187 | Classifications
188 | ^^^^^^^^^^^^^^^
189 | Searching for classifications works similarly to the above:
190 |
191 | .. code-block:: python
192 |
193 | import ticketpy
194 |
195 | tm_client = ticketpy.ApiClient("your_api_key")
196 | classifications = tm_client.classifications.find(keyword="Drama").one()
197 |
198 | for cl in classifications:
199 | print("Segment: {}".format(cl.segment.name))
200 | for genre in cl.segment.genres:
201 | print("--Genre: {}".format(genre.name))
202 |
203 | Output::
204 |
205 | Segment: Film
206 | --Genre: Drama
207 | Segment: Arts & Theatre
208 | --Genre: Theatre
209 |
210 | Querying details for classifications by ID will return either a ``Segment``,
211 | ``Genre``, or ``SubGenre``, whichever matches the given ID.
212 |
213 | For example,
214 |
215 | .. code-block:: python
216 |
217 | import ticketpy
218 |
219 | tm_client = ticketpy.ApiClient("your_api_key")
220 | x = tm_client.classifications.by_id('KZFzniwnSyZfZ7v7nJ')
221 | y = tm_client.classifications.by_id('KnvZfZ7vAvE')
222 | z = tm_client.classifications.by_id('KZazBEonSMnZfZ7vkdl')
223 |
224 | s = "Name: {} / Type: {}"
225 | print(s.format(x.name, type(x)))
226 | print(s.format(y.name, type(y)))
227 | print(s.format(z.name, type(z)))
228 |
229 | Output::
230 |
231 | Name: Music / Type:
232 | Name: Jazz / Type:
233 | Name: Bebop / Type:
234 |
235 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/doctools.js:
--------------------------------------------------------------------------------
1 | /*
2 | * doctools.js
3 | * ~~~~~~~~~~~
4 | *
5 | * Sphinx JavaScript utilities for all documentation.
6 | *
7 | * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | /**
13 | * select a different prefix for underscore
14 | */
15 | $u = _.noConflict();
16 |
17 | /**
18 | * make the code below compatible with browsers without
19 | * an installed firebug like debugger
20 | if (!window.console || !console.firebug) {
21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
23 | "profile", "profileEnd"];
24 | window.console = {};
25 | for (var i = 0; i < names.length; ++i)
26 | window.console[names[i]] = function() {};
27 | }
28 | */
29 |
30 | /**
31 | * small helper function to urldecode strings
32 | */
33 | jQuery.urldecode = function(x) {
34 | return decodeURIComponent(x).replace(/\+/g, ' ');
35 | };
36 |
37 | /**
38 | * small helper function to urlencode strings
39 | */
40 | jQuery.urlencode = encodeURIComponent;
41 |
42 | /**
43 | * This function returns the parsed url parameters of the
44 | * current request. Multiple values per key are supported,
45 | * it will always return arrays of strings for the value parts.
46 | */
47 | jQuery.getQueryParameters = function(s) {
48 | if (typeof s == 'undefined')
49 | s = document.location.search;
50 | var parts = s.substr(s.indexOf('?') + 1).split('&');
51 | var result = {};
52 | for (var i = 0; i < parts.length; i++) {
53 | var tmp = parts[i].split('=', 2);
54 | var key = jQuery.urldecode(tmp[0]);
55 | var value = jQuery.urldecode(tmp[1]);
56 | if (key in result)
57 | result[key].push(value);
58 | else
59 | result[key] = [value];
60 | }
61 | return result;
62 | };
63 |
64 | /**
65 | * highlight a given string on a jquery object by wrapping it in
66 | * span elements with the given class name.
67 | */
68 | jQuery.fn.highlightText = function(text, className) {
69 | function highlight(node) {
70 | if (node.nodeType == 3) {
71 | var val = node.nodeValue;
72 | var pos = val.toLowerCase().indexOf(text);
73 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
74 | var span = document.createElement("span");
75 | span.className = className;
76 | span.appendChild(document.createTextNode(val.substr(pos, text.length)));
77 | node.parentNode.insertBefore(span, node.parentNode.insertBefore(
78 | document.createTextNode(val.substr(pos + text.length)),
79 | node.nextSibling));
80 | node.nodeValue = val.substr(0, pos);
81 | }
82 | }
83 | else if (!jQuery(node).is("button, select, textarea")) {
84 | jQuery.each(node.childNodes, function() {
85 | highlight(this);
86 | });
87 | }
88 | }
89 | return this.each(function() {
90 | highlight(this);
91 | });
92 | };
93 |
94 | /*
95 | * backward compatibility for jQuery.browser
96 | * This will be supported until firefox bug is fixed.
97 | */
98 | if (!jQuery.browser) {
99 | jQuery.uaMatch = function(ua) {
100 | ua = ua.toLowerCase();
101 |
102 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
103 | /(webkit)[ \/]([\w.]+)/.exec(ua) ||
104 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
105 | /(msie) ([\w.]+)/.exec(ua) ||
106 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
107 | [];
108 |
109 | return {
110 | browser: match[ 1 ] || "",
111 | version: match[ 2 ] || "0"
112 | };
113 | };
114 | jQuery.browser = {};
115 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
116 | }
117 |
118 | /**
119 | * Small JavaScript module for the documentation.
120 | */
121 | var Documentation = {
122 |
123 | init : function() {
124 | this.fixFirefoxAnchorBug();
125 | this.highlightSearchWords();
126 | this.initIndexTable();
127 |
128 | },
129 |
130 | /**
131 | * i18n support
132 | */
133 | TRANSLATIONS : {},
134 | PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
135 | LOCALE : 'unknown',
136 |
137 | // gettext and ngettext don't access this so that the functions
138 | // can safely bound to a different name (_ = Documentation.gettext)
139 | gettext : function(string) {
140 | var translated = Documentation.TRANSLATIONS[string];
141 | if (typeof translated == 'undefined')
142 | return string;
143 | return (typeof translated == 'string') ? translated : translated[0];
144 | },
145 |
146 | ngettext : function(singular, plural, n) {
147 | var translated = Documentation.TRANSLATIONS[singular];
148 | if (typeof translated == 'undefined')
149 | return (n == 1) ? singular : plural;
150 | return translated[Documentation.PLURALEXPR(n)];
151 | },
152 |
153 | addTranslations : function(catalog) {
154 | for (var key in catalog.messages)
155 | this.TRANSLATIONS[key] = catalog.messages[key];
156 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
157 | this.LOCALE = catalog.locale;
158 | },
159 |
160 | /**
161 | * add context elements like header anchor links
162 | */
163 | addContextElements : function() {
164 | $('div[id] > :header:first').each(function() {
165 | $('').
166 | attr('href', '#' + this.id).
167 | attr('title', _('Permalink to this headline')).
168 | appendTo(this);
169 | });
170 | $('dt[id]').each(function() {
171 | $('').
172 | attr('href', '#' + this.id).
173 | attr('title', _('Permalink to this definition')).
174 | appendTo(this);
175 | });
176 | },
177 |
178 | /**
179 | * workaround a firefox stupidity
180 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
181 | */
182 | fixFirefoxAnchorBug : function() {
183 | if (document.location.hash)
184 | window.setTimeout(function() {
185 | document.location.href += '';
186 | }, 10);
187 | },
188 |
189 | /**
190 | * highlight the search words provided in the url in the text
191 | */
192 | highlightSearchWords : function() {
193 | var params = $.getQueryParameters();
194 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
195 | if (terms.length) {
196 | var body = $('div.body');
197 | if (!body.length) {
198 | body = $('body');
199 | }
200 | window.setTimeout(function() {
201 | $.each(terms, function() {
202 | body.highlightText(this.toLowerCase(), 'highlighted');
203 | });
204 | }, 10);
205 | $('' + _('Hide Search Matches') + '
')
207 | .appendTo($('#searchbox'));
208 | }
209 | },
210 |
211 | /**
212 | * init the domain index toggle buttons
213 | */
214 | initIndexTable : function() {
215 | var togglers = $('img.toggler').click(function() {
216 | var src = $(this).attr('src');
217 | var idnum = $(this).attr('id').substr(7);
218 | $('tr.cg-' + idnum).toggle();
219 | if (src.substr(-9) == 'minus.png')
220 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
221 | else
222 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
223 | }).css('display', '');
224 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
225 | togglers.click();
226 | }
227 | },
228 |
229 | /**
230 | * helper function to hide the search marks again
231 | */
232 | hideSearchWords : function() {
233 | $('#searchbox .highlight-link').fadeOut(300);
234 | $('span.highlighted').removeClass('highlighted');
235 | },
236 |
237 | /**
238 | * make the url absolute
239 | */
240 | makeURL : function(relativeURL) {
241 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
242 | },
243 |
244 | /**
245 | * get the current relative url
246 | */
247 | getCurrentURL : function() {
248 | var path = document.location.pathname;
249 | var parts = path.split(/\//);
250 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
251 | if (this == '..')
252 | parts.pop();
253 | });
254 | var url = parts.join('/');
255 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
256 | },
257 |
258 | initOnKeyListeners: function() {
259 | $(document).keyup(function(event) {
260 | var activeElementType = document.activeElement.tagName;
261 | // don't navigate when in search box or textarea
262 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') {
263 | switch (event.keyCode) {
264 | case 37: // left
265 | var prevHref = $('link[rel="prev"]').prop('href');
266 | if (prevHref) {
267 | window.location.href = prevHref;
268 | return false;
269 | }
270 | case 39: // right
271 | var nextHref = $('link[rel="next"]').prop('href');
272 | if (nextHref) {
273 | window.location.href = nextHref;
274 | return false;
275 | }
276 | }
277 | }
278 | });
279 | }
280 | };
281 |
282 | // quick alias for translations
283 | _ = Documentation.gettext;
284 |
285 | $(document).ready(function() {
286 | Documentation.init();
287 | });
--------------------------------------------------------------------------------
/ticketpy/client.py:
--------------------------------------------------------------------------------
1 | """API client classes"""
2 | import logging
3 | import requests
4 | from collections import namedtuple
5 | from urllib import parse
6 | from ticketpy.query import (
7 | AttractionQuery,
8 | ClassificationQuery,
9 | EventQuery,
10 | VenueQuery
11 | )
12 | from ticketpy.model import Page
13 |
14 | log = logging.getLogger(__name__)
15 | log.setLevel(logging.INFO)
16 | sh = logging.StreamHandler()
17 | sh.setLevel(logging.INFO)
18 | sf = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
19 | sh.setFormatter(sf)
20 | log.addHandler(sh)
21 |
22 |
23 | class ApiClient:
24 | """ApiClient is the main wrapper for the Discovery API.
25 |
26 | **Example**:
27 | Get the first page result for venues matching keyword '*Tabernacle*':
28 |
29 | .. code-block:: python
30 |
31 | import ticketpy
32 |
33 | client = ticketpy.ApiClient("your_api_key")
34 | resp = client.venues.find(keyword="Tabernacle").one()
35 | for venue in resp:
36 | print(venue.name)
37 |
38 | Output::
39 |
40 | Tabernacle
41 | The Tabernacle
42 | Tabernacle, Notting Hill
43 | Bethel Tabernacle
44 | Revivaltime Tabernacle
45 | ...
46 |
47 | Request URLs end up looking like:
48 | http://app.ticketmaster.com/discovery/v2/events.json?apikey={api_key}
49 | """
50 | root_url = 'https://app.ticketmaster.com'
51 | url = 'https://app.ticketmaster.com/discovery/v2'
52 |
53 | def __init__(self, api_key):
54 | self.__api_key = None
55 | self.api_key = api_key
56 | self.events = EventQuery(api_client=self)
57 | self.venues = VenueQuery(api_client=self)
58 | self.attractions = AttractionQuery(api_client=self)
59 | self.classifications = ClassificationQuery(api_client=self)
60 | self.segment_by_id = self.classifications.segment_by_id
61 | self.genre_by_id = self.classifications.genre_by_id
62 | self.subgenre_by_id = self.classifications.subgenre_by_id
63 |
64 | log.debug("Root URL: {}".format(self.url))
65 |
66 | def search(self, method, **kwargs):
67 | """Generic API request
68 |
69 | :param method: Search type (*events*, *venues*...)
70 | :param kwargs: Search parameters (*venueId*, *eventId*,
71 | *latlong*, etc...)
72 | :return: ``PagedResponse``
73 | """
74 | # Remove unfilled parameters, add apikey header.
75 | # Clean up values that might be passed in multiple ways.
76 | # Ex: 'includeTBA' might be passed as bool(True) instead of 'yes'
77 | # and 'radius' might be passed as int(2) instead of '2'
78 | kwargs = {k: v for (k, v) in kwargs.items() if v is not None}
79 | updates = self.api_key
80 |
81 | for k, v in kwargs.items():
82 | if k in ['includeTBA', 'includeTBD', 'includeTest']:
83 | updates[k] = self.__yes_no_only(v)
84 | elif k in ['size', 'radius', 'marketId']:
85 | updates[k] = str(v)
86 | kwargs.update(updates)
87 | log.debug(kwargs)
88 | urls = {
89 | 'events': self.__method_url('events'),
90 | 'venues': self.__method_url('venues'),
91 | 'attractions': self.__method_url('attractions'),
92 | 'classifications': self.__method_url('classifications')
93 | }
94 | resp = requests.get(urls[method], params=kwargs)
95 | return PagedResponse(self, self._handle_response(resp))
96 |
97 | def _handle_response(self, response):
98 | """Raises ``ApiException`` if needed, or returns response JSON obj
99 |
100 | Status codes
101 | * 401 = Invalid API key or rate limit quota violation
102 | * 400 = Invalid URL parameter
103 | """
104 | if response.status_code == 200:
105 | return self.__success(response)
106 | elif response.status_code == 401:
107 | self.__fault(response)
108 | elif response.status_code == 400:
109 | self.__error(response)
110 | else:
111 | self.__unknown_error(response)
112 |
113 | @staticmethod
114 | def __success(response):
115 | """Successful response, just return JSON"""
116 | return response.json()
117 |
118 | @staticmethod
119 | def __error(response):
120 | """HTTP status code 400, or something with 'errors' object"""
121 | rj = response.json()
122 | error = namedtuple('error', ['code', 'detail', 'href'])
123 | errors = [
124 | error(err['code'], err['detail'], err['_links']['about']['href'])
125 | for err in rj['errors']
126 | ]
127 | log.error('URL: {}\nErrors: {}'.format(response.url, errors))
128 | raise ApiException(response.status_code, errors, response.url)
129 |
130 | @staticmethod
131 | def __fault(response):
132 | """HTTP status code 401, or something with 'faults' object"""
133 | rj = response.json()
134 | fault_str = rj['fault']['faultstring']
135 | detail = rj['fault']['detail']
136 | log.error('URL: {}, Faultstr: {}'.format(response.url, fault_str))
137 | raise ApiException(
138 | response.status_code,
139 | fault_str,
140 | detail,
141 | response.url
142 | )
143 |
144 | def __unknown_error(self, response):
145 | """Unexpected HTTP status code (not 200, 400, or 401)"""
146 | rj = response.json()
147 | if 'fault' in rj:
148 | self.__fault(response)
149 | elif 'errors' in rj:
150 | self.__error(response)
151 | else:
152 | raise ApiException(response.status_code, response.text)
153 |
154 | def get_url(self, link):
155 | """Gets a specific href from '_links' object in a response"""
156 | # API sometimes return incorrectly-formatted strings, need
157 | # to parse out parameters and pass them into a new request
158 | # rather than implicitly trusting the href in _links
159 | link = self._parse_link(link)
160 | resp = requests.get(link.url, link.params)
161 | return Page.from_json(self._handle_response(resp))
162 |
163 | def _parse_link(self, link):
164 | """Parses link into base URL and dict of parameters"""
165 | parsed_link = namedtuple('link', ['url', 'params'])
166 | link_url, link_params = link.split('?')
167 | params = self._link_params(link_params)
168 | return parsed_link(link_url, params)
169 |
170 | def _link_params(self, param_str):
171 | """Parse URL parameters from href split on '?' character"""
172 | search_params = {}
173 | params = parse.parse_qs(param_str)
174 | for k, v in params.items():
175 | search_params[k] = v[0]
176 | search_params.update(self.api_key)
177 | return search_params
178 |
179 | @property
180 | def api_key(self):
181 | return self.__api_key
182 |
183 | @api_key.setter
184 | def api_key(self, api_key):
185 | # Set this way by default to pass in request params
186 | self.__api_key = {'apikey': api_key}
187 |
188 | @staticmethod
189 | def __method_url(method):
190 | """Formats a search method URL"""
191 | return "{}/{}.json".format(ApiClient.url, method)
192 |
193 | @staticmethod
194 | def __yes_no_only(s):
195 | """Helper for parameters expecting ['yes', 'no', 'only']"""
196 | s = str(s).lower()
197 | if s in ['true', 'yes']:
198 | s = 'yes'
199 | elif s in ['false', 'no']:
200 | s = 'no'
201 | return s
202 |
203 |
204 | class ApiException(Exception):
205 | """Exception thrown for API-related error messages"""
206 | def __init__(self, *args):
207 | super().__init__(*args)
208 |
209 |
210 | class PagedResponse:
211 | """Iterates through API response pages"""
212 | def __init__(self, api_client, response):
213 | self.api_client = api_client
214 | self.page = None
215 | self.page = Page.from_json(response)
216 |
217 | def limit(self, max_pages=5):
218 | """Retrieve X number of pages, returning a ``list`` of all entities.
219 |
220 | Rather than iterating through ``PagedResponse`` to retrieve
221 | each page (and its events/venues/etc), ``limit()`` will
222 | automatically iterate up to ``max_pages`` and return
223 | a flat/joined list of items in each ``Page``
224 |
225 | :param max_pages: Max page requests to make before returning list
226 | :return: Flat list of results from pages
227 | """
228 | all_items = []
229 | counter = 0
230 | for pg in self:
231 | if counter >= max_pages:
232 | break
233 | counter += 1
234 | all_items += pg
235 | return all_items
236 |
237 | def one(self):
238 | """Get items from first page result"""
239 | return [i for i in self.page]
240 |
241 | def maximum(self):
242 | """Retrieves **maximum** pages in a result, returning a flat list.
243 | API limits paging depth to (page * size) <= 1000
244 |
245 | Use ``limit()`` to restrict the number of page requests being made.
246 | **WARNING**: Generic searches may involve *a lot* of pages...
247 |
248 | :return: Flat list of results
249 | """
250 | max_pages = 49 # do not exceed allowed paging depth
251 | all_items = []
252 | counter = 0
253 | for pg in self:
254 | if counter >= max_pages:
255 | break
256 | counter += 1
257 | all_items += pg
258 | return all_items
259 |
260 | def __iter__(self):
261 | yield self.page
262 | next_url = self.page.links.get('next')
263 | while next_url:
264 | log.debug("Requesting page: {}".format(next_url))
265 | pg = self.api_client.get_url(next_url)
266 | next_url = pg.links.get('next')
267 | yield pg
268 | return
269 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/underscore.js:
--------------------------------------------------------------------------------
1 | // Underscore.js 1.3.1
2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3 | // Underscore is freely distributable under the MIT license.
4 | // Portions of Underscore are inspired or borrowed from Prototype,
5 | // Oliver Steele's Functional, and John Resig's Micro-Templating.
6 | // For all details and documentation:
7 | // http://documentcloud.github.com/underscore
8 | (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,
10 | h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each=
11 | b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==
12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};
24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e /g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),
28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+
29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
32 |
--------------------------------------------------------------------------------
/ticketpy/tests/test_ticketpy.py:
--------------------------------------------------------------------------------
1 | from unittest import TestCase, skip
2 | from configparser import ConfigParser
3 | import os
4 | import ticketpy
5 | from ticketpy.client import ApiException
6 | from math import radians, cos, sin, asin, sqrt
7 |
8 |
9 | def haversine(latlon1, latlon2):
10 | """
11 | Calculate the great circle distance between two points
12 | on the earth (specified in decimal degrees)
13 |
14 | Sourced from Stack Overflow:
15 | https://stackoverflow.com/questions/4913349/haversine-formula-in-python-bearing-and-distance-between-two-gps-points
16 | """
17 | # convert decimal degrees to radians
18 | lat1 = float(latlon1['latitude'])
19 | lon1 = float(latlon1['longitude'])
20 | lat2 = float(latlon2['latitude'])
21 | lon2 = float(latlon2['longitude'])
22 | lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
23 | # haversine formula
24 | dlon = lon2 - lon1
25 | dlat = lat2 - lat1
26 | a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
27 | c = 2 * asin(sqrt(a))
28 | r = 3956 # Radius of earth in kilometers. Use 6371 for kilometers
29 | return c * r
30 |
31 |
32 | def get_client():
33 | """Returns ApiClient with api key from config.ini"""
34 | config = ConfigParser()
35 | config.read(os.path.join(os.path.dirname(__file__), 'config.ini'))
36 | api_key = config.get('ticketmaster', 'api_key')
37 | return ticketpy.ApiClient(api_key)
38 |
39 |
40 | class TestApiClient(TestCase):
41 | def setUp(self):
42 | self.api_client = get_client()
43 |
44 | def test_parse_link(self):
45 | base_str = "https://app.ticketmaster.com/discovery/v2/events"
46 | param_str = ("sort=date,asc"
47 | "&marketId=10"
48 | "&keyword=LCD%20Soundsystem")
49 | full_url = '{}?{}'.format(base_str, param_str)
50 | parsed_link = self.api_client._parse_link(full_url)
51 | self.assertEqual(base_str, parsed_link.url)
52 |
53 | params = parsed_link.params
54 | self.assertEqual('date,asc', params['sort'])
55 | self.assertEqual('10', params['marketId'])
56 | self.assertEqual('LCD Soundsystem', params['keyword'])
57 | self.assertEqual(self.api_client.api_key['apikey'], params['apikey'])
58 |
59 | def test_apikey(self):
60 | tmp_client = ticketpy.ApiClient('random_key')
61 | self.assertIn('apikey', tmp_client.api_key)
62 | self.assertEqual('random_key', tmp_client.api_key['apikey'])
63 |
64 | def test_url(self):
65 | expected_url = "https://app.ticketmaster.com/discovery/v2"
66 | self.assertEqual(self.api_client.url, expected_url)
67 |
68 | def test_method_url(self):
69 | murl = self.api_client._ApiClient__method_url
70 | expected_url = "https://app.ticketmaster.com/discovery/v2/events.json"
71 | events_url = murl('events')
72 | self.assertEqual(expected_url, events_url)
73 |
74 | def test_bad_key(self):
75 | bad_client = ticketpy.ApiClient('asdf')
76 | self.assertRaises(ApiException, bad_client.venues.find, keyword="a")
77 |
78 | def test__bad_request(self):
79 | # Radius should be a whole number, so 1.5 should raise ApiException
80 | radius = '1.5'
81 | lat = '33.7838737'
82 | long = '-84.366088'
83 |
84 | self.assertRaises(ApiException, self.api_client.events.by_location,
85 | latitude=lat, longitude=long, radius=radius)
86 |
87 | def test___yes_no_only(self):
88 | yno = self.api_client._ApiClient__yes_no_only
89 | self.assertEqual(yno('yes'), 'yes')
90 | self.assertEqual(yno('YES'), 'yes')
91 | self.assertEqual(yno('Yes'), 'yes')
92 | self.assertEqual(yno(True), 'yes')
93 |
94 | self.assertEqual(yno('no'), 'no')
95 | self.assertEqual(yno('NO'), 'no')
96 | self.assertEqual(yno('No'), 'no')
97 | self.assertEqual(yno(False), 'no')
98 |
99 | self.assertEqual(yno('only'), 'only')
100 | self.assertEqual(yno('ONLY'), 'only')
101 | self.assertEqual(yno('Only'), 'only')
102 |
103 | self.assertEqual(yno('asdf'), 'asdf')
104 | self.assertEqual(yno('Asdf'), 'asdf')
105 |
106 |
107 | class TestVenueQuery(TestCase):
108 | def setUp(self):
109 | self.tm = get_client()
110 | self.venues = {
111 | 'smithes': 'KovZpZAJledA',
112 | 'tabernacle': 'KovZpaFEZe'
113 | }
114 |
115 | def test_find(self):
116 | venue_list = self.tm.venues.find(keyword="TABERNACLE").limit(2)
117 | for v in venue_list:
118 | self.assertIn("TABERNACLE", v.name.upper())
119 |
120 | def test_by_name(self):
121 | # Make sure this returns only venues matching search terms...
122 | venue_name = "TABERNACLE"
123 | state = "GA"
124 | venue_list = self.tm.venues.by_name(venue_name, state).limit(2)
125 | for venue in venue_list:
126 | self.assertIn(venue_name, venue.name.upper())
127 |
128 | def test_get_venue(self):
129 | venue_name = 'Tabernacle'
130 | v = self.tm.venues.by_id(self.venues['tabernacle'])
131 | self.assertEqual(self.venues['tabernacle'], v.id)
132 | self.assertIn(venue_name, v.name)
133 |
134 |
135 | class TestClassificationQuery(TestCase):
136 | def setUp(self):
137 | self.tm = get_client()
138 |
139 | def test_classification_search(self):
140 | classif = self.tm.classifications.find(keyword="DRAMA").limit()
141 | segment_names = [cl.segment.name for cl in classif]
142 | self.assertIn('Film', segment_names)
143 | genre_names = []
144 | for cl in classif:
145 | genre_names += [g.name.upper() for g in cl.segment.genres]
146 | self.assertIn("DRAMA", genre_names)
147 |
148 | def test_classification_by_id(self):
149 | genre_id = 'KnvZfZ7vAvE'
150 | nested_genre = self.tm.classifications.by_id(genre_id)
151 | genre_ids = [genre.id for genre in nested_genre.segment.genres]
152 | self.assertIn(genre_id, genre_ids)
153 |
154 | def test_classification_by_id_404(self):
155 | self.assertRaises(ApiException, self.tm.classifications.by_id, 'asdf')
156 |
157 | def test_segment_by_id(self):
158 | seg_id = 'KZFzniwnSyZfZ7v7nJ'
159 | seg_name = 'Music'
160 | seg = self.tm.segment_by_id(seg_id)
161 | self.assertEqual(seg_id, seg.id)
162 | self.assertEqual(seg_name, seg.name)
163 |
164 | seg_x = self.tm.segment_by_id(seg_id)
165 | self.assertEqual(seg_id, seg_x.id)
166 | self.assertEqual(seg_name, seg_x.name)
167 |
168 | def test_genre_by_id(self):
169 | genre_id = 'KnvZfZ7vAvE'
170 | genre_name = 'Jazz'
171 | g = self.tm.genre_by_id(genre_id)
172 | self.assertEqual(genre_id, g.id)
173 | self.assertEqual(genre_name, g.name)
174 |
175 | g_x = self.tm.genre_by_id(genre_id)
176 | self.assertEqual(genre_id, g_x.id)
177 | self.assertEqual(genre_name, g_x.name)
178 |
179 | def test_subgenre_by_id(self):
180 | subgenre_id = 'KZazBEonSMnZfZ7vkdl'
181 | subgenre_name = 'Bebop'
182 | sg = self.tm.subgenre_by_id(subgenre_id)
183 | self.assertEqual(subgenre_id, sg.id)
184 | self.assertEqual(subgenre_name, sg.name)
185 | sg_x = self.tm.subgenre_by_id(subgenre_id)
186 | self.assertEqual(subgenre_id, sg_x.id)
187 | self.assertEqual(subgenre_name, sg_x.name)
188 |
189 |
190 | class TestAttractionQuery(TestCase):
191 | def setUp(self):
192 | self.tm = get_client()
193 |
194 | def test_attraction_search(self):
195 | attr_name = "YANKEES"
196 | attractions = self.tm.attractions.find(keyword=attr_name).limit(1)
197 | attraction_names = [a.name for a in attractions]
198 |
199 | matched = False
200 | for a in attraction_names:
201 | if attr_name in a.upper():
202 | matched = True
203 | self.assertTrue(matched)
204 |
205 | def test_attraction_by_id(self):
206 | attraction_id = 'K8vZ9171okV'
207 | attraction_name = 'New York Yankees'
208 | attr = self.tm.attractions.by_id(attraction_id)
209 | self.assertEqual(attraction_id, attr.id)
210 | self.assertEqual(attraction_name, attr.name)
211 |
212 |
213 | class TestEventQuery(TestCase):
214 | def setUp(self):
215 | self.tm = get_client()
216 |
217 | @skip("Skipping until test update")
218 | def test_get_event_id(self):
219 | # TODO search events, then pull a specific ID to use here
220 | event_id = 'vvG1zZfbJQpVWp'
221 | e = self.tm.events.by_id(event_id)
222 | self.assertEqual(event_id, e.id)
223 |
224 | def test_get_event_id_404(self):
225 | self.assertRaises(ApiException, self.tm.events.by_id, "asdf")
226 |
227 | def test_search_events_by_location(self):
228 | # Search for events within 1 mile of lat/lon
229 | # Coordinates here are vaguely within Virginia Highlands
230 | # It might be sort of overkill, but the distance between the
231 | # original latitude/longitude is measured against what's
232 | # returned for the venue and we only evaluate events/venues
233 | # within 3 miles of the original coordinates. This is because
234 | # the API will return crazy far results if you let it
235 | # (ex: sorting by date,asc returns events in Austin...)
236 | city = 'Atlanta'
237 | latlon1 = {'latitude': '33.7838737', 'longitude': '-84.366088'}
238 |
239 | event_list = self.tm.events.by_location(
240 | latitude=latlon1['latitude'],
241 | longitude=latlon1['longitude'],
242 | radius=3,
243 | unit='miles'
244 | ).limit(3)
245 |
246 | all_nearby = []
247 | for e in event_list:
248 | nearby = [v for v in e.venues if
249 | haversine(latlon1,
250 | {'latitude': v.location['latitude'],
251 | 'longitude': v.location['longitude']}) <= 3]
252 | all_nearby += nearby
253 | # Ensure we aren't passing the test on an empty list
254 | self.assertGreater(len(all_nearby), 0)
255 | # Every city in the (populated) list should be Atlanta
256 | for v in all_nearby:
257 | self.assertEqual(city, v.city)
258 | self.assertEqual(city, v.location['city'])
259 |
260 | def test_search_events(self):
261 | venue_id = 'KovZpaFEZe'
262 | venue_name = 'Tabernacle'
263 | event_list = self.tm.events.find(venue_id=venue_id, size=2).limit(4)
264 | for e in event_list:
265 | for v in e.venues:
266 | with self.subTest(venue_id=venue_id):
267 | self.assertEqual(venue_id, v.id)
268 | with self.subTest(venue_name=venue_name):
269 | self.assertIn(venue_name, v.name)
270 |
271 | def test_events_get(self):
272 | genre_name = 'Hip-Hop'
273 | venue_id = 'KovZpZAJledA'
274 | venue_name = "Smith's Olde Bar"
275 |
276 | elist = self.tm.events.find(
277 | classification_name=genre_name,
278 | venue_id=venue_id
279 | ).limit(2)
280 |
281 | for e in elist:
282 | for v in e.venues:
283 | self.assertEqual(venue_id, v.id)
284 | self.assertEqual(venue_name, v.name)
285 | genres = [ec.genre.name for ec in e.classifications]
286 |
287 | matches = False
288 | for g in genres:
289 | if genre_name in g:
290 | matches = True
291 | self.assertTrue(matches)
292 |
293 |
294 | class TestPagedResponse(TestCase):
295 | def setUp(self):
296 | self.tm = get_client()
297 |
298 | def test_one(self):
299 | # Generic search returns numerous pages, ensure only 1 is returned
300 | event_list = self.tm.events.find(state_code='GA', size=7).one()
301 | self.assertEqual(7, len(event_list))
302 | resp = self.tm.venues.find(keyword='Tabernacle', size=5).one()
303 | self.assertEqual(5, len(resp))
304 |
305 | def test_limit(self):
306 | # API page size default=20, limit(max_pages) default=5
307 | with_defaults = self.tm.events.find().limit()
308 | self.assertEqual(100, len(with_defaults))
309 |
310 | # Switch up defaults
311 | multi = self.tm.events.find(state_code='GA', size=8).limit(3)
312 | self.assertEqual(24, len(multi))
313 |
314 | def test_all(self):
315 | # Manually iterate through response, then iterate automatically
316 | # via all(), so both lists of venue IDs should be equal.
317 | # page_counter should eventually equal the total_pages
318 | # from the first page as well
319 | page_iter = self.tm.venues.find(keyword="TABERNACLE", size=5)
320 | iter_all = [venue.id for venue in page_iter.all()]
321 | iter_manual = []
322 |
323 | page_counter = 0
324 | total_pages = None
325 | for pg in page_iter:
326 | if page_counter == 0:
327 | total_pages = pg.total_pages
328 | page_counter += 1
329 | iter_manual += [venue.id for venue in pg]
330 |
331 | self.assertEqual(page_counter, total_pages)
332 | self.assertListEqual(iter_all, iter_manual)
333 |
334 |
335 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/basic.css:
--------------------------------------------------------------------------------
1 | /*
2 | * basic.css
3 | * ~~~~~~~~~
4 | *
5 | * Sphinx stylesheet -- basic theme.
6 | *
7 | * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | /* -- main layout ----------------------------------------------------------- */
13 |
14 | div.clearer {
15 | clear: both;
16 | }
17 |
18 | /* -- relbar ---------------------------------------------------------------- */
19 |
20 | div.related {
21 | width: 100%;
22 | font-size: 90%;
23 | }
24 |
25 | div.related h3 {
26 | display: none;
27 | }
28 |
29 | div.related ul {
30 | margin: 0;
31 | padding: 0 0 0 10px;
32 | list-style: none;
33 | }
34 |
35 | div.related li {
36 | display: inline;
37 | }
38 |
39 | div.related li.right {
40 | float: right;
41 | margin-right: 5px;
42 | }
43 |
44 | /* -- sidebar --------------------------------------------------------------- */
45 |
46 | div.sphinxsidebarwrapper {
47 | padding: 10px 5px 0 10px;
48 | }
49 |
50 | div.sphinxsidebar {
51 | float: left;
52 | width: 230px;
53 | margin-left: -100%;
54 | font-size: 90%;
55 | word-wrap: break-word;
56 | overflow-wrap : break-word;
57 | }
58 |
59 | div.sphinxsidebar ul {
60 | list-style: none;
61 | }
62 |
63 | div.sphinxsidebar ul ul,
64 | div.sphinxsidebar ul.want-points {
65 | margin-left: 20px;
66 | list-style: square;
67 | }
68 |
69 | div.sphinxsidebar ul ul {
70 | margin-top: 0;
71 | margin-bottom: 0;
72 | }
73 |
74 | div.sphinxsidebar form {
75 | margin-top: 10px;
76 | }
77 |
78 | div.sphinxsidebar input {
79 | border: 1px solid #98dbcc;
80 | font-family: sans-serif;
81 | font-size: 1em;
82 | }
83 |
84 | div.sphinxsidebar #searchbox input[type="text"] {
85 | width: 170px;
86 | }
87 |
88 | img {
89 | border: 0;
90 | max-width: 100%;
91 | }
92 |
93 | /* -- search page ----------------------------------------------------------- */
94 |
95 | ul.search {
96 | margin: 10px 0 0 20px;
97 | padding: 0;
98 | }
99 |
100 | ul.search li {
101 | padding: 5px 0 5px 20px;
102 | background-image: url(file.png);
103 | background-repeat: no-repeat;
104 | background-position: 0 7px;
105 | }
106 |
107 | ul.search li a {
108 | font-weight: bold;
109 | }
110 |
111 | ul.search li div.context {
112 | color: #888;
113 | margin: 2px 0 0 30px;
114 | text-align: left;
115 | }
116 |
117 | ul.keywordmatches li.goodmatch a {
118 | font-weight: bold;
119 | }
120 |
121 | /* -- index page ------------------------------------------------------------ */
122 |
123 | table.contentstable {
124 | width: 90%;
125 | margin-left: auto;
126 | margin-right: auto;
127 | }
128 |
129 | table.contentstable p.biglink {
130 | line-height: 150%;
131 | }
132 |
133 | a.biglink {
134 | font-size: 1.3em;
135 | }
136 |
137 | span.linkdescr {
138 | font-style: italic;
139 | padding-top: 5px;
140 | font-size: 90%;
141 | }
142 |
143 | /* -- general index --------------------------------------------------------- */
144 |
145 | table.indextable {
146 | width: 100%;
147 | }
148 |
149 | table.indextable td {
150 | text-align: left;
151 | vertical-align: top;
152 | }
153 |
154 | table.indextable ul {
155 | margin-top: 0;
156 | margin-bottom: 0;
157 | list-style-type: none;
158 | }
159 |
160 | table.indextable > tbody > tr > td > ul {
161 | padding-left: 0em;
162 | }
163 |
164 | table.indextable tr.pcap {
165 | height: 10px;
166 | }
167 |
168 | table.indextable tr.cap {
169 | margin-top: 10px;
170 | background-color: #f2f2f2;
171 | }
172 |
173 | img.toggler {
174 | margin-right: 3px;
175 | margin-top: 3px;
176 | cursor: pointer;
177 | }
178 |
179 | div.modindex-jumpbox {
180 | border-top: 1px solid #ddd;
181 | border-bottom: 1px solid #ddd;
182 | margin: 1em 0 1em 0;
183 | padding: 0.4em;
184 | }
185 |
186 | div.genindex-jumpbox {
187 | border-top: 1px solid #ddd;
188 | border-bottom: 1px solid #ddd;
189 | margin: 1em 0 1em 0;
190 | padding: 0.4em;
191 | }
192 |
193 | /* -- domain module index --------------------------------------------------- */
194 |
195 | table.modindextable td {
196 | padding: 2px;
197 | border-collapse: collapse;
198 | }
199 |
200 | /* -- general body styles --------------------------------------------------- */
201 |
202 | div.body p, div.body dd, div.body li, div.body blockquote {
203 | -moz-hyphens: auto;
204 | -ms-hyphens: auto;
205 | -webkit-hyphens: auto;
206 | hyphens: auto;
207 | }
208 |
209 | a.headerlink {
210 | visibility: hidden;
211 | }
212 |
213 | h1:hover > a.headerlink,
214 | h2:hover > a.headerlink,
215 | h3:hover > a.headerlink,
216 | h4:hover > a.headerlink,
217 | h5:hover > a.headerlink,
218 | h6:hover > a.headerlink,
219 | dt:hover > a.headerlink,
220 | caption:hover > a.headerlink,
221 | p.caption:hover > a.headerlink,
222 | div.code-block-caption:hover > a.headerlink {
223 | visibility: visible;
224 | }
225 |
226 | div.body p.caption {
227 | text-align: inherit;
228 | }
229 |
230 | div.body td {
231 | text-align: left;
232 | }
233 |
234 | .first {
235 | margin-top: 0 !important;
236 | }
237 |
238 | p.rubric {
239 | margin-top: 30px;
240 | font-weight: bold;
241 | }
242 |
243 | img.align-left, .figure.align-left, object.align-left {
244 | clear: left;
245 | float: left;
246 | margin-right: 1em;
247 | }
248 |
249 | img.align-right, .figure.align-right, object.align-right {
250 | clear: right;
251 | float: right;
252 | margin-left: 1em;
253 | }
254 |
255 | img.align-center, .figure.align-center, object.align-center {
256 | display: block;
257 | margin-left: auto;
258 | margin-right: auto;
259 | }
260 |
261 | .align-left {
262 | text-align: left;
263 | }
264 |
265 | .align-center {
266 | text-align: center;
267 | }
268 |
269 | .align-right {
270 | text-align: right;
271 | }
272 |
273 | /* -- sidebars -------------------------------------------------------------- */
274 |
275 | div.sidebar {
276 | margin: 0 0 0.5em 1em;
277 | border: 1px solid #ddb;
278 | padding: 7px 7px 0 7px;
279 | background-color: #ffe;
280 | width: 40%;
281 | float: right;
282 | }
283 |
284 | p.sidebar-title {
285 | font-weight: bold;
286 | }
287 |
288 | /* -- topics ---------------------------------------------------------------- */
289 |
290 | div.topic {
291 | border: 1px solid #ccc;
292 | padding: 7px 7px 0 7px;
293 | margin: 10px 0 10px 0;
294 | }
295 |
296 | p.topic-title {
297 | font-size: 1.1em;
298 | font-weight: bold;
299 | margin-top: 10px;
300 | }
301 |
302 | /* -- admonitions ----------------------------------------------------------- */
303 |
304 | div.admonition {
305 | margin-top: 10px;
306 | margin-bottom: 10px;
307 | padding: 7px;
308 | }
309 |
310 | div.admonition dt {
311 | font-weight: bold;
312 | }
313 |
314 | div.admonition dl {
315 | margin-bottom: 0;
316 | }
317 |
318 | p.admonition-title {
319 | margin: 0px 10px 5px 0px;
320 | font-weight: bold;
321 | }
322 |
323 | div.body p.centered {
324 | text-align: center;
325 | margin-top: 25px;
326 | }
327 |
328 | /* -- tables ---------------------------------------------------------------- */
329 |
330 | table.docutils {
331 | border: 0;
332 | border-collapse: collapse;
333 | }
334 |
335 | table caption span.caption-number {
336 | font-style: italic;
337 | }
338 |
339 | table caption span.caption-text {
340 | }
341 |
342 | table.docutils td, table.docutils th {
343 | padding: 1px 8px 1px 5px;
344 | border-top: 0;
345 | border-left: 0;
346 | border-right: 0;
347 | border-bottom: 1px solid #aaa;
348 | }
349 |
350 | table.footnote td, table.footnote th {
351 | border: 0 !important;
352 | }
353 |
354 | th {
355 | text-align: left;
356 | padding-right: 5px;
357 | }
358 |
359 | table.citation {
360 | border-left: solid 1px gray;
361 | margin-left: 1px;
362 | }
363 |
364 | table.citation td {
365 | border-bottom: none;
366 | }
367 |
368 | /* -- figures --------------------------------------------------------------- */
369 |
370 | div.figure {
371 | margin: 0.5em;
372 | padding: 0.5em;
373 | }
374 |
375 | div.figure p.caption {
376 | padding: 0.3em;
377 | }
378 |
379 | div.figure p.caption span.caption-number {
380 | font-style: italic;
381 | }
382 |
383 | div.figure p.caption span.caption-text {
384 | }
385 |
386 | /* -- field list styles ----------------------------------------------------- */
387 |
388 | table.field-list td, table.field-list th {
389 | border: 0 !important;
390 | }
391 |
392 | .field-list ul {
393 | margin: 0;
394 | padding-left: 1em;
395 | }
396 |
397 | .field-list p {
398 | margin: 0;
399 | }
400 |
401 | .field-name {
402 | -moz-hyphens: manual;
403 | -ms-hyphens: manual;
404 | -webkit-hyphens: manual;
405 | hyphens: manual;
406 | }
407 |
408 | /* -- other body styles ----------------------------------------------------- */
409 |
410 | ol.arabic {
411 | list-style: decimal;
412 | }
413 |
414 | ol.loweralpha {
415 | list-style: lower-alpha;
416 | }
417 |
418 | ol.upperalpha {
419 | list-style: upper-alpha;
420 | }
421 |
422 | ol.lowerroman {
423 | list-style: lower-roman;
424 | }
425 |
426 | ol.upperroman {
427 | list-style: upper-roman;
428 | }
429 |
430 | dl {
431 | margin-bottom: 15px;
432 | }
433 |
434 | dd p {
435 | margin-top: 0px;
436 | }
437 |
438 | dd ul, dd table {
439 | margin-bottom: 10px;
440 | }
441 |
442 | dd {
443 | margin-top: 3px;
444 | margin-bottom: 10px;
445 | margin-left: 30px;
446 | }
447 |
448 | dt:target, .highlighted {
449 | background-color: #fbe54e;
450 | }
451 |
452 | dl.glossary dt {
453 | font-weight: bold;
454 | font-size: 1.1em;
455 | }
456 |
457 | .optional {
458 | font-size: 1.3em;
459 | }
460 |
461 | .sig-paren {
462 | font-size: larger;
463 | }
464 |
465 | .versionmodified {
466 | font-style: italic;
467 | }
468 |
469 | .system-message {
470 | background-color: #fda;
471 | padding: 5px;
472 | border: 3px solid red;
473 | }
474 |
475 | .footnote:target {
476 | background-color: #ffa;
477 | }
478 |
479 | .line-block {
480 | display: block;
481 | margin-top: 1em;
482 | margin-bottom: 1em;
483 | }
484 |
485 | .line-block .line-block {
486 | margin-top: 0;
487 | margin-bottom: 0;
488 | margin-left: 1.5em;
489 | }
490 |
491 | .guilabel, .menuselection {
492 | font-family: sans-serif;
493 | }
494 |
495 | .accelerator {
496 | text-decoration: underline;
497 | }
498 |
499 | .classifier {
500 | font-style: oblique;
501 | }
502 |
503 | abbr, acronym {
504 | border-bottom: dotted 1px;
505 | cursor: help;
506 | }
507 |
508 | /* -- code displays --------------------------------------------------------- */
509 |
510 | pre {
511 | overflow: auto;
512 | overflow-y: hidden; /* fixes display issues on Chrome browsers */
513 | }
514 |
515 | span.pre {
516 | -moz-hyphens: none;
517 | -ms-hyphens: none;
518 | -webkit-hyphens: none;
519 | hyphens: none;
520 | }
521 |
522 | td.linenos pre {
523 | padding: 5px 0px;
524 | border: 0;
525 | background-color: transparent;
526 | color: #aaa;
527 | }
528 |
529 | table.highlighttable {
530 | margin-left: 0.5em;
531 | }
532 |
533 | table.highlighttable td {
534 | padding: 0 0.5em 0 0.5em;
535 | }
536 |
537 | div.code-block-caption {
538 | padding: 2px 5px;
539 | font-size: small;
540 | }
541 |
542 | div.code-block-caption code {
543 | background-color: transparent;
544 | }
545 |
546 | div.code-block-caption + div > div.highlight > pre {
547 | margin-top: 0;
548 | }
549 |
550 | div.code-block-caption span.caption-number {
551 | padding: 0.1em 0.3em;
552 | font-style: italic;
553 | }
554 |
555 | div.code-block-caption span.caption-text {
556 | }
557 |
558 | div.literal-block-wrapper {
559 | padding: 1em 1em 0;
560 | }
561 |
562 | div.literal-block-wrapper div.highlight {
563 | margin: 0;
564 | }
565 |
566 | code.descname {
567 | background-color: transparent;
568 | font-weight: bold;
569 | font-size: 1.2em;
570 | }
571 |
572 | code.descclassname {
573 | background-color: transparent;
574 | }
575 |
576 | code.xref, a code {
577 | background-color: transparent;
578 | font-weight: bold;
579 | }
580 |
581 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
582 | background-color: transparent;
583 | }
584 |
585 | .viewcode-link {
586 | float: right;
587 | }
588 |
589 | .viewcode-back {
590 | float: right;
591 | font-family: sans-serif;
592 | }
593 |
594 | div.viewcode-block:target {
595 | margin: -1px -10px;
596 | padding: 0 10px;
597 | }
598 |
599 | /* -- math display ---------------------------------------------------------- */
600 |
601 | img.math {
602 | vertical-align: middle;
603 | }
604 |
605 | div.body div.math p {
606 | text-align: center;
607 | }
608 |
609 | span.eqno {
610 | float: right;
611 | }
612 |
613 | span.eqno a.headerlink {
614 | position: relative;
615 | left: 0px;
616 | z-index: 1;
617 | }
618 |
619 | div.math:hover a.headerlink {
620 | visibility: visible;
621 | }
622 |
623 | /* -- printout stylesheet --------------------------------------------------- */
624 |
625 | @media print {
626 | div.document,
627 | div.documentwrapper,
628 | div.bodywrapper {
629 | margin: 0 !important;
630 | width: 100%;
631 | }
632 |
633 | div.sphinxsidebar,
634 | div.related,
635 | div.footer,
636 | #top-link {
637 | display: none;
638 | }
639 | }
--------------------------------------------------------------------------------
/docs/_build/html/_static/alabaster.css:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | @import url("basic.css");
54 |
55 | /* -- page layout ----------------------------------------------------------- */
56 |
57 | body {
58 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif;
59 | font-size: 17px;
60 | background-color: #fff;
61 | color: #000;
62 | margin: 0;
63 | padding: 0;
64 | }
65 |
66 |
67 | div.document {
68 | width: 940px;
69 | margin: 30px auto 0 auto;
70 | }
71 |
72 | div.documentwrapper {
73 | float: left;
74 | width: 100%;
75 | }
76 |
77 | div.bodywrapper {
78 | margin: 0 0 0 220px;
79 | }
80 |
81 | div.sphinxsidebar {
82 | width: 220px;
83 | font-size: 14px;
84 | line-height: 1.5;
85 | }
86 |
87 | hr {
88 | border: 1px solid #B1B4B6;
89 | }
90 |
91 | div.body {
92 | background-color: #fff;
93 | color: #3E4349;
94 | padding: 0 30px 0 30px;
95 | }
96 |
97 | div.body > .section {
98 | text-align: left;
99 | }
100 |
101 | div.footer {
102 | width: 940px;
103 | margin: 20px auto 30px auto;
104 | font-size: 14px;
105 | color: #888;
106 | text-align: right;
107 | }
108 |
109 | div.footer a {
110 | color: #888;
111 | }
112 |
113 | p.caption {
114 | font-family: inherit;
115 | font-size: inherit;
116 | }
117 |
118 |
119 | div.relations {
120 | display: none;
121 | }
122 |
123 |
124 | div.sphinxsidebar a {
125 | color: #444;
126 | text-decoration: none;
127 | border-bottom: 1px dotted #999;
128 | }
129 |
130 | div.sphinxsidebar a:hover {
131 | border-bottom: 1px solid #999;
132 | }
133 |
134 | div.sphinxsidebarwrapper {
135 | padding: 18px 10px;
136 | }
137 |
138 | div.sphinxsidebarwrapper p.logo {
139 | padding: 0;
140 | margin: -10px 0 0 0px;
141 | text-align: center;
142 | }
143 |
144 | div.sphinxsidebarwrapper h1.logo {
145 | margin-top: -10px;
146 | text-align: center;
147 | margin-bottom: 5px;
148 | text-align: left;
149 | }
150 |
151 | div.sphinxsidebarwrapper h1.logo-name {
152 | margin-top: 0px;
153 | }
154 |
155 | div.sphinxsidebarwrapper p.blurb {
156 | margin-top: 0;
157 | font-style: normal;
158 | }
159 |
160 | div.sphinxsidebar h3,
161 | div.sphinxsidebar h4 {
162 | font-family: 'Garamond', 'Georgia', serif;
163 | color: #444;
164 | font-size: 24px;
165 | font-weight: normal;
166 | margin: 0 0 5px 0;
167 | padding: 0;
168 | }
169 |
170 | div.sphinxsidebar h4 {
171 | font-size: 20px;
172 | }
173 |
174 | div.sphinxsidebar h3 a {
175 | color: #444;
176 | }
177 |
178 | div.sphinxsidebar p.logo a,
179 | div.sphinxsidebar h3 a,
180 | div.sphinxsidebar p.logo a:hover,
181 | div.sphinxsidebar h3 a:hover {
182 | border: none;
183 | }
184 |
185 | div.sphinxsidebar p {
186 | color: #555;
187 | margin: 10px 0;
188 | }
189 |
190 | div.sphinxsidebar ul {
191 | margin: 10px 0;
192 | padding: 0;
193 | color: #000;
194 | }
195 |
196 | div.sphinxsidebar ul li.toctree-l1 > a {
197 | font-size: 120%;
198 | }
199 |
200 | div.sphinxsidebar ul li.toctree-l2 > a {
201 | font-size: 110%;
202 | }
203 |
204 | div.sphinxsidebar input {
205 | border: 1px solid #CCC;
206 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif;
207 | font-size: 1em;
208 | }
209 |
210 | div.sphinxsidebar hr {
211 | border: none;
212 | height: 1px;
213 | color: #AAA;
214 | background: #AAA;
215 |
216 | text-align: left;
217 | margin-left: 0;
218 | width: 50%;
219 | }
220 |
221 | /* -- body styles ----------------------------------------------------------- */
222 |
223 | a {
224 | color: #004B6B;
225 | text-decoration: underline;
226 | }
227 |
228 | a:hover {
229 | color: #6D4100;
230 | text-decoration: underline;
231 | }
232 |
233 | div.body h1,
234 | div.body h2,
235 | div.body h3,
236 | div.body h4,
237 | div.body h5,
238 | div.body h6 {
239 | font-family: 'Garamond', 'Georgia', serif;
240 | font-weight: normal;
241 | margin: 30px 0px 10px 0px;
242 | padding: 0;
243 | }
244 |
245 | div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
246 | div.body h2 { font-size: 180%; }
247 | div.body h3 { font-size: 150%; }
248 | div.body h4 { font-size: 130%; }
249 | div.body h5 { font-size: 100%; }
250 | div.body h6 { font-size: 100%; }
251 |
252 | a.headerlink {
253 | color: #DDD;
254 | padding: 0 4px;
255 | text-decoration: none;
256 | }
257 |
258 | a.headerlink:hover {
259 | color: #444;
260 | background: #EAEAEA;
261 | }
262 |
263 | div.body p, div.body dd, div.body li {
264 | line-height: 1.4em;
265 | }
266 |
267 | div.admonition {
268 | margin: 20px 0px;
269 | padding: 10px 30px;
270 | background-color: #EEE;
271 | border: 1px solid #CCC;
272 | }
273 |
274 | div.admonition tt.xref, div.admonition code.xref, div.admonition a tt {
275 | background-color: #FBFBFB;
276 | border-bottom: 1px solid #fafafa;
277 | }
278 |
279 | div.admonition p.admonition-title {
280 | font-family: 'Garamond', 'Georgia', serif;
281 | font-weight: normal;
282 | font-size: 24px;
283 | margin: 0 0 10px 0;
284 | padding: 0;
285 | line-height: 1;
286 | }
287 |
288 | div.admonition p.last {
289 | margin-bottom: 0;
290 | }
291 |
292 | div.highlight {
293 | background-color: #fff;
294 | }
295 |
296 | dt:target, .highlight {
297 | background: #FAF3E8;
298 | }
299 |
300 | div.warning {
301 | background-color: #FCC;
302 | border: 1px solid #FAA;
303 | }
304 |
305 | div.danger {
306 | background-color: #FCC;
307 | border: 1px solid #FAA;
308 | -moz-box-shadow: 2px 2px 4px #D52C2C;
309 | -webkit-box-shadow: 2px 2px 4px #D52C2C;
310 | box-shadow: 2px 2px 4px #D52C2C;
311 | }
312 |
313 | div.error {
314 | background-color: #FCC;
315 | border: 1px solid #FAA;
316 | -moz-box-shadow: 2px 2px 4px #D52C2C;
317 | -webkit-box-shadow: 2px 2px 4px #D52C2C;
318 | box-shadow: 2px 2px 4px #D52C2C;
319 | }
320 |
321 | div.caution {
322 | background-color: #FCC;
323 | border: 1px solid #FAA;
324 | }
325 |
326 | div.attention {
327 | background-color: #FCC;
328 | border: 1px solid #FAA;
329 | }
330 |
331 | div.important {
332 | background-color: #EEE;
333 | border: 1px solid #CCC;
334 | }
335 |
336 | div.note {
337 | background-color: #EEE;
338 | border: 1px solid #CCC;
339 | }
340 |
341 | div.tip {
342 | background-color: #EEE;
343 | border: 1px solid #CCC;
344 | }
345 |
346 | div.hint {
347 | background-color: #EEE;
348 | border: 1px solid #CCC;
349 | }
350 |
351 | div.seealso {
352 | background-color: #EEE;
353 | border: 1px solid #CCC;
354 | }
355 |
356 | div.topic {
357 | background-color: #EEE;
358 | }
359 |
360 | p.admonition-title {
361 | display: inline;
362 | }
363 |
364 | p.admonition-title:after {
365 | content: ":";
366 | }
367 |
368 | pre, tt, code {
369 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
370 | font-size: 0.9em;
371 | }
372 |
373 | .hll {
374 | background-color: #FFC;
375 | margin: 0 -12px;
376 | padding: 0 12px;
377 | display: block;
378 | }
379 |
380 | img.screenshot {
381 | }
382 |
383 | tt.descname, tt.descclassname, code.descname, code.descclassname {
384 | font-size: 0.95em;
385 | }
386 |
387 | tt.descname, code.descname {
388 | padding-right: 0.08em;
389 | }
390 |
391 | img.screenshot {
392 | -moz-box-shadow: 2px 2px 4px #EEE;
393 | -webkit-box-shadow: 2px 2px 4px #EEE;
394 | box-shadow: 2px 2px 4px #EEE;
395 | }
396 |
397 | table.docutils {
398 | border: 1px solid #888;
399 | -moz-box-shadow: 2px 2px 4px #EEE;
400 | -webkit-box-shadow: 2px 2px 4px #EEE;
401 | box-shadow: 2px 2px 4px #EEE;
402 | }
403 |
404 | table.docutils td, table.docutils th {
405 | border: 1px solid #888;
406 | padding: 0.25em 0.7em;
407 | }
408 |
409 | table.field-list, table.footnote {
410 | border: none;
411 | -moz-box-shadow: none;
412 | -webkit-box-shadow: none;
413 | box-shadow: none;
414 | }
415 |
416 | table.footnote {
417 | margin: 15px 0;
418 | width: 100%;
419 | border: 1px solid #EEE;
420 | background: #FDFDFD;
421 | font-size: 0.9em;
422 | }
423 |
424 | table.footnote + table.footnote {
425 | margin-top: -15px;
426 | border-top: none;
427 | }
428 |
429 | table.field-list th {
430 | padding: 0 0.8em 0 0;
431 | }
432 |
433 | table.field-list td {
434 | padding: 0;
435 | }
436 |
437 | table.field-list p {
438 | margin-bottom: 0.8em;
439 | }
440 |
441 | /* Cloned from
442 | * https://github.com/sphinx-doc/sphinx/commit/ef60dbfce09286b20b7385333d63a60321784e68
443 | */
444 | .field-name {
445 | -moz-hyphens: manual;
446 | -ms-hyphens: manual;
447 | -webkit-hyphens: manual;
448 | hyphens: manual;
449 | }
450 |
451 | table.footnote td.label {
452 | width: .1px;
453 | padding: 0.3em 0 0.3em 0.5em;
454 | }
455 |
456 | table.footnote td {
457 | padding: 0.3em 0.5em;
458 | }
459 |
460 | dl {
461 | margin: 0;
462 | padding: 0;
463 | }
464 |
465 | dl dd {
466 | margin-left: 30px;
467 | }
468 |
469 | blockquote {
470 | margin: 0 0 0 30px;
471 | padding: 0;
472 | }
473 |
474 | ul, ol {
475 | /* Matches the 30px from the narrow-screen "li > ul" selector below */
476 | margin: 10px 0 10px 30px;
477 | padding: 0;
478 | }
479 |
480 | pre {
481 | background: #EEE;
482 | padding: 7px 30px;
483 | margin: 15px 0px;
484 | line-height: 1.3em;
485 | }
486 |
487 | div.viewcode-block:target {
488 | background: #ffd;
489 | }
490 |
491 | dl pre, blockquote pre, li pre {
492 | margin-left: 0;
493 | padding-left: 30px;
494 | }
495 |
496 | tt, code {
497 | background-color: #ecf0f3;
498 | color: #222;
499 | /* padding: 1px 2px; */
500 | }
501 |
502 | tt.xref, code.xref, a tt {
503 | background-color: #FBFBFB;
504 | border-bottom: 1px solid #fff;
505 | }
506 |
507 | a.reference {
508 | text-decoration: none;
509 | border-bottom: 1px dotted #004B6B;
510 | }
511 |
512 | /* Don't put an underline on images */
513 | a.image-reference, a.image-reference:hover {
514 | border-bottom: none;
515 | }
516 |
517 | a.reference:hover {
518 | border-bottom: 1px solid #6D4100;
519 | }
520 |
521 | a.footnote-reference {
522 | text-decoration: none;
523 | font-size: 0.7em;
524 | vertical-align: top;
525 | border-bottom: 1px dotted #004B6B;
526 | }
527 |
528 | a.footnote-reference:hover {
529 | border-bottom: 1px solid #6D4100;
530 | }
531 |
532 | a:hover tt, a:hover code {
533 | background: #EEE;
534 | }
535 |
536 |
537 | @media screen and (max-width: 870px) {
538 |
539 | div.sphinxsidebar {
540 | display: none;
541 | }
542 |
543 | div.document {
544 | width: 100%;
545 |
546 | }
547 |
548 | div.documentwrapper {
549 | margin-left: 0;
550 | margin-top: 0;
551 | margin-right: 0;
552 | margin-bottom: 0;
553 | }
554 |
555 | div.bodywrapper {
556 | margin-top: 0;
557 | margin-right: 0;
558 | margin-bottom: 0;
559 | margin-left: 0;
560 | }
561 |
562 | ul {
563 | margin-left: 0;
564 | }
565 |
566 | li > ul {
567 | /* Matches the 30px from the "ul, ol" selector above */
568 | margin-left: 30px;
569 | }
570 |
571 | .document {
572 | width: auto;
573 | }
574 |
575 | .footer {
576 | width: auto;
577 | }
578 |
579 | .bodywrapper {
580 | margin: 0;
581 | }
582 |
583 | .footer {
584 | width: auto;
585 | }
586 |
587 | .github {
588 | display: none;
589 | }
590 |
591 |
592 |
593 | }
594 |
595 |
596 |
597 | @media screen and (max-width: 875px) {
598 |
599 | body {
600 | margin: 0;
601 | padding: 20px 30px;
602 | }
603 |
604 | div.documentwrapper {
605 | float: none;
606 | background: #fff;
607 | }
608 |
609 | div.sphinxsidebar {
610 | display: block;
611 | float: none;
612 | width: 102.5%;
613 | margin: 50px -30px -20px -30px;
614 | padding: 10px 20px;
615 | background: #333;
616 | color: #FFF;
617 | }
618 |
619 | div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
620 | div.sphinxsidebar h3 a {
621 | color: #fff;
622 | }
623 |
624 | div.sphinxsidebar a {
625 | color: #AAA;
626 | }
627 |
628 | div.sphinxsidebar p.logo {
629 | display: none;
630 | }
631 |
632 | div.document {
633 | width: 100%;
634 | margin: 0;
635 | }
636 |
637 | div.footer {
638 | display: none;
639 | }
640 |
641 | div.bodywrapper {
642 | margin: 0;
643 | }
644 |
645 | div.body {
646 | min-height: 0;
647 | padding: 0;
648 | }
649 |
650 | .rtd_doc_footer {
651 | display: none;
652 | }
653 |
654 | .document {
655 | width: auto;
656 | }
657 |
658 | .footer {
659 | width: auto;
660 | }
661 |
662 | .footer {
663 | width: auto;
664 | }
665 |
666 | .github {
667 | display: none;
668 | }
669 | }
670 |
671 |
672 | /* misc. */
673 |
674 | .revsys-inline {
675 | display: none!important;
676 | }
677 |
678 | /* Make nested-list/multi-paragraph items look better in Releases changelog
679 | * pages. Without this, docutils' magical list fuckery causes inconsistent
680 | * formatting between different release sub-lists.
681 | */
682 | div#changelog > div.section > ul > li > p:only-child {
683 | margin-bottom: 0;
684 | }
685 |
686 | /* Hide fugly table cell borders in ..bibliography:: directive output */
687 | table.docutils.citation, table.docutils.citation td, table.docutils.citation th {
688 | border: none;
689 | /* Below needed in some edge cases; if not applied, bottom shadows appear */
690 | -moz-box-shadow: none;
691 | -webkit-box-shadow: none;
692 | box-shadow: none;
693 | }
--------------------------------------------------------------------------------
/docs/_build/html/genindex.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 | Index — ticketpy 1.1.1 documentation
10 |
11 |
12 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
Index
49 |
50 |
51 |
A
52 | |
B
53 | |
C
54 | |
E
55 | |
F
56 | |
G
57 | |
L
58 | |
O
59 | |
P
60 | |
R
61 | |
S
62 | |
T
63 | |
U
64 | |
V
65 |
66 |
67 |
A
68 |
88 |
89 |
B
90 |
104 |
105 |
C
106 |
120 |
121 |
E
122 |
134 |
135 |
F
136 |
170 |
171 |
G
172 |
184 |
185 |
L
186 |
200 |
201 |
O
202 |
208 |
209 |
P
210 |
220 |
221 |
R
222 |
228 |
229 |
S
230 |
250 |
251 |
T
252 |
264 |
265 |
U
266 |
276 |
277 |
V
278 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
311 |
312 |
313 |
325 |
329 |
330 |
--------------------------------------------------------------------------------
/ticketpy/query.py:
--------------------------------------------------------------------------------
1 | """Classes to handle API queries/searches"""
2 | import requests
3 | from ticketpy.model import Venue, Event, Attraction, Classification
4 |
5 |
6 | class BaseQuery:
7 | """Base query/parent class for specific serach types."""
8 | #: Maps parameter names to parameters expected by the API
9 | #: (ex: *market_id* maps to *marketId*)
10 | attr_map = {
11 | 'start_date_time': 'startDateTime',
12 | 'end_date_time': 'endDateTime',
13 | 'onsale_start_date_time': 'onsaleStartDateTime',
14 | 'onsale_end_date_time': 'onsaleEndDateTime',
15 | 'country_code': 'countryCode',
16 | 'state_code': 'stateCode',
17 | 'venue_id': 'venueId',
18 | 'attraction_id': 'attractionId',
19 | 'segment_id': 'segmentId',
20 | 'segment_name': 'segmentName',
21 | 'classification_name': 'classificationName',
22 | 'classification_id': 'classificationId',
23 | 'market_id': 'marketId',
24 | 'promoter_id': 'promoterId',
25 | 'dma_id': 'dmaId',
26 | 'include_tba': 'includeTBA',
27 | 'include_tbd': 'includeTBD',
28 | 'client_visibility': 'clientVisibility',
29 | 'include_test': 'includeTest',
30 | 'keyword': 'keyword',
31 | 'id': 'id',
32 | 'sort': 'sort',
33 | 'page': 'page',
34 | 'size': 'size',
35 | 'locale': 'locale',
36 | 'latlong': 'latlong',
37 | 'radius': 'radius'
38 | }
39 |
40 | def __init__(self, api_client, method, model):
41 | """
42 | :param api_client: Instance of ``ticketpy.client.ApiClient``
43 | :param method: API method (ex: *events*, *venues*...)
44 | :param model: Model from ``ticketpy.model``. Either
45 | ``Event``, ``Venue``, ``Attraction`` or ``Classification``
46 | """
47 | self.api_client = api_client
48 | self.method = method
49 | self.model = model
50 |
51 | def __get(self, **kwargs):
52 | """Sends final request to ``ApiClient``"""
53 | response = self.api_client.search(self.method, **kwargs)
54 | return response
55 |
56 | def _get(self, keyword=None, entity_id=None, sort=None, include_test=None,
57 | page=None, size=None, locale=None, **kwargs):
58 | """Basic API search request, with only the parameters common to all
59 | search functions. Specific searches pass theirs through **kwargs.
60 |
61 | :param keyword: Keyword to search on
62 | :param entity_id: ID of the object type (such as an event ID...)
63 | :param sort: Sort method
64 | :param include_test: ['yes', 'no', 'only'] to include test objects in
65 | results. Default: *no*
66 | :param page: Page to return (default: 0)
67 | :param size: Page size (default: 20)
68 | :param locale: Locale (default: *en*)
69 | :param kwargs: Additional search parameters
70 | :return:
71 | """
72 | # Combine universal parameters and supplied kwargs into single dict,
73 | # then map our parameter names to the ones expected by the API and
74 | # make the final request
75 | search_args = dict(kwargs)
76 | search_args.update({
77 | 'keyword': keyword,
78 | 'id': entity_id,
79 | 'sort': sort,
80 | 'include_test': include_test,
81 | 'page': page,
82 | 'size': size,
83 | 'locale': locale
84 | })
85 | params = self._search_params(**search_args)
86 | return self.__get(**params)
87 |
88 | def by_id(self, entity_id):
89 | """Get a specific object by its ID"""
90 | get_tmpl = "{}/{}/{}"
91 | get_url = get_tmpl.format(self.api_client.url, self.method, entity_id)
92 | r = requests.get(get_url, params=self.api_client.api_key)
93 | r_json = self.api_client._handle_response(r)
94 | return self.model.from_json(r_json)
95 |
96 | def _search_params(self, **kwargs):
97 | """Returns API-friendly search parameters from kwargs
98 |
99 | Maps parameter names to ``self.attr_map`` and removes
100 | paramters == ``None``
101 |
102 | :param kwargs: Keyword arguments
103 | :return: API-friendly parameters
104 | """
105 | # Update search parameters with kwargs
106 | kw_map = {}
107 | for k, v in kwargs.items():
108 | # If arg is API-friendly (ex: stateCode='GA')
109 | if k in self.attr_map.keys():
110 | kw_map[self.attr_map[k]] = v
111 | elif k in self.attr_map.values():
112 | kw_map[k] = v
113 | else:
114 | kw_map[k] = v
115 |
116 | return {k: v for (k, v) in kw_map.items() if v is not None}
117 |
118 |
119 | class AttractionQuery(BaseQuery):
120 | """Query class for Attractions"""
121 | def __init__(self, api_client):
122 | self.api_client = api_client
123 | super().__init__(api_client, 'attractions', Attraction)
124 |
125 | def find(self, sort=None, keyword=None, attraction_id=None,
126 | source=None, include_test=None, page=None, size=None,
127 | locale=None, **kwargs):
128 | """
129 | :param sort: Response sort type (API default: *name,asc*)
130 | :param keyword:
131 | :param attraction_id:
132 | :param source:
133 | :param include_test: Include test attractions (['yes', 'no', 'only'])
134 | :param page:
135 | :param size:
136 | :param locale: API default: *en*
137 | :param kwargs:
138 | :return:
139 | """
140 | return self._get(keyword, attraction_id, sort, include_test,
141 | page, size, locale, source=source, **kwargs)
142 |
143 |
144 | class ClassificationQuery(BaseQuery):
145 | """Classification search/query class"""
146 |
147 | def __init__(self, api_client):
148 | super().__init__(api_client, 'classifications', Classification)
149 |
150 | def find(self, sort=None, keyword=None, classification_id=None,
151 | source=None, include_test=None, page=None, size=None,
152 | locale=None, **kwargs):
153 | """Search classifications
154 |
155 | :param sort: Response sort type (API default: *name,asc*)
156 | :param keyword:
157 | :param classification_id:
158 | :param source:
159 | :param include_test: Include test classifications
160 | (['yes', 'no', 'only'])
161 | :param page:
162 | :param size:
163 | :param locale: API default: *en*
164 | :param kwargs:
165 | :return:
166 | """
167 | return self._get(keyword, classification_id, sort, include_test,
168 | page, size, locale, source=source, **kwargs)
169 |
170 | def segment_by_id(self, segment_id):
171 | """Return a ``Segment`` matching this ID"""
172 | return self.by_id(segment_id).segment
173 |
174 | def genre_by_id(self, genre_id):
175 | """Return a ``Genre`` matching this ID"""
176 | genre = None
177 | resp = self.by_id(genre_id)
178 | if resp.segment:
179 | for genre in resp.segment.genres:
180 | if genre.id == genre_id:
181 | genre = genre
182 | return genre
183 |
184 | def subgenre_by_id(self, subgenre_id):
185 | """Return a ``SubGenre`` matching this ID"""
186 | subgenre = None
187 | segment = self.by_id(subgenre_id).segment
188 | if segment:
189 | subgenres = [
190 | subg for genre in segment.genres
191 | for subg in genre.subgenres
192 | ]
193 | for subg in subgenres:
194 | if subg.id == subgenre_id:
195 | subgenre = subg
196 | return subgenre
197 |
198 |
199 | class EventQuery(BaseQuery):
200 | """Abstraction to search API for events"""
201 | def __init__(self, api_client):
202 | super().__init__(api_client, 'events', Event)
203 |
204 | def find(self, sort='date,asc', latlong=None, radius=None, unit=None,
205 | start_date_time=None, end_date_time=None,
206 | onsale_start_date_time=None, onsale_end_date_time=None,
207 | country_code=None, state_code=None, venue_id=None,
208 | attraction_id=None, segment_id=None, segment_name=None,
209 | classification_name=None, classification_id=None,
210 | market_id=None, promoter_id=None, dma_id=None,
211 | include_tba=None, include_tbd=None, client_visibility=None,
212 | keyword=None, event_id=None, source=None, include_test=None,
213 | page=None, size=None, locale=None, **kwargs):
214 | """Search for events matching given criteria.
215 |
216 | :param sort: Sorting order of search result
217 | (default: *'relevance,desc'*)
218 | :param latlong: Latitude/longitude filter
219 | :param radius: Radius of area to search
220 | :param unit: Unit of radius, 'miles' or 'km' (default: miles)
221 | :param start_date_time: Filter by start date/time.
222 | Timestamp format: *YYYY-MM-DDTHH:MM:SSZ*
223 | :param end_date_time: Filter by end date/time.
224 | Timestamp format: *YYYY-MM-DDTHH:MM:SSZ*
225 | :param onsale_start_date_time:
226 | :param onsale_end_date_time:
227 | :param country_code:
228 | :param state_code: State code (ex: 'GA' not 'Georgia')
229 | :param venue_id: Find events for provided venue ID
230 | :param attraction_id:
231 | :param segment_id:
232 | :param segment_name:
233 | :param classification_name: Filter events by a list of
234 | classification name(s) (genre/subgenre/type/subtype/segment)
235 | :param classification_id:
236 | :param market_id:
237 | :param promoter_id:
238 | :param dma_id:
239 | :param include_tba: True to include events with a to-be-announced
240 | date (['yes', 'no', 'only'])
241 | :param include_tbd: True to include an event with a date to be
242 | defined (['yes', 'no', 'only'])
243 | :param client_visibility:
244 | :param keyword:
245 | :param event_id: Event ID to search
246 | :param source: Filter entities by source name: ['ticketmaster',
247 | 'universe', 'frontgate', 'tmr']
248 | :param include_test: 'yes' to include test entities in the
249 | response. False or 'no' to exclude. 'only' to return ONLY test
250 | entities. (['yes', 'no', 'only'])
251 | :param page: Page number to get (default: 0)
252 | :param size: Size of page (default: 20)
253 | :param locale: Locale (default: 'en')
254 | :return:
255 | """
256 | return self._get(keyword, event_id, sort, include_test, page,
257 | size, locale, latlong=latlong, radius=radius,
258 | unit=unit, start_date_time=start_date_time,
259 | end_date_time=end_date_time,
260 | onsale_start_date_time=onsale_start_date_time,
261 | onsale_end_date_time=onsale_end_date_time,
262 | country_code=country_code, state_code=state_code,
263 | venue_id=venue_id, attraction_id=attraction_id,
264 | segment_id=segment_id, segment_name=segment_name,
265 | classification_name=classification_name,
266 | classification_id=classification_id,
267 | market_id=market_id, promoter_id=promoter_id,
268 | dma_id=dma_id, include_tba=include_tba,
269 | include_tbd=include_tbd, source=source,
270 | client_visibility=client_visibility, **kwargs)
271 |
272 | def by_location(self, latitude, longitude, radius='10', unit='miles',
273 | sort='relevance,desc', **kwargs):
274 | """Search events within a radius of a latitude/longitude coordinate.
275 |
276 | :param latitude: Latitude of radius center
277 | :param longitude: Longitude of radius center
278 | :param radius: Radius to search outside given latitude/longitude
279 | :param unit: Unit of radius ('miles' or 'km'),
280 | :param sort: Sort method. (Default: *relevance, desc*). If changed,
281 | you may get wonky results (*date, asc* returns far-away events)
282 | :return: List of events within that area
283 | """
284 | latitude = str(latitude)
285 | longitude = str(longitude)
286 | radius = str(radius)
287 | latlong = "{lat},{long}".format(lat=latitude, long=longitude)
288 | return self.find(
289 | latlong=latlong,
290 | radius=radius,
291 | unit=unit,
292 | sort=sort,
293 | **kwargs
294 | )
295 |
296 |
297 | class VenueQuery(BaseQuery):
298 | """Queries for venues"""
299 | def __init__(self, api_client):
300 | super().__init__(api_client, 'venues', Venue)
301 |
302 | def find(self, keyword=None, venue_id=None, sort=None, state_code=None,
303 | country_code=None, source=None, include_test=None,
304 | page=None, size=None, locale=None, **kwargs):
305 | """Search for venues matching provided parameters
306 |
307 | :param keyword: Keyword to search on (such as part of the venue name)
308 | :param venue_id: Venue ID
309 | :param sort: Sort method for response (API default: 'name,asc')
310 | :param state_code: Filter by state code (ex: 'GA' not 'Georgia')
311 | :param country_code: Filter by country code
312 | :param source: Filter entities by source (['ticketmaster', 'universe',
313 | 'frontgate', 'tmr'])
314 | :param include_test: ['yes', 'no', 'only'], whether to include
315 | entities flagged as test in the response (default: 'no')
316 | :param page: Page number (default: 0)
317 | :param size: Page size of the response (default: 20)
318 | :param locale: Locale (default: 'en')
319 | :return: Venues found matching criteria
320 | :rtype: ``ticketpy.PagedResponse``
321 | """
322 | return self._get(keyword, venue_id, sort, include_test, page,
323 | size, locale, state_code=state_code,
324 | country_code=country_code, source=source, **kwargs)
325 |
326 | def by_name(self, venue_name, state_code=None, **kwargs):
327 | """Search for a venue by name.
328 |
329 | :param venue_name: Venue name to search
330 | :param state_code: Two-letter state code to narrow results (ex 'GA')
331 | (default: None)
332 | :return: List of venues found matching search criteria
333 | """
334 | return self.find(keyword=venue_name, state_code=state_code, **kwargs)
335 |
--------------------------------------------------------------------------------
/ticketpy/model.py:
--------------------------------------------------------------------------------
1 | """Models for API objects"""
2 | from datetime import datetime
3 | import re
4 | import ticketpy
5 |
6 |
7 | def _assign_links(obj, json_obj, base_url=None):
8 | """Assigns ``links`` attribute to an object from JSON"""
9 | # Normal link strucutre is {link_name: {'href': url}},
10 | # but some responses also have lists of other models.
11 | # API occasionally returns bad URLs (with {&sort} and similar)
12 | json_links = json_obj.get('_links')
13 | if not json_links:
14 | obj.links = {}
15 | else:
16 | obj_links = {}
17 | for k, v in json_links.items():
18 | if 'href' in v:
19 | href = re.sub("({.+})", "", v['href'])
20 | if base_url:
21 | href = "{}{}".format(base_url, href)
22 | obj_links[k] = href
23 | else:
24 | obj_links[k] = v
25 | obj.links = obj_links
26 |
27 |
28 | class Page(list):
29 | """API response page"""
30 | def __init__(self, number=None, size=None, total_elements=None,
31 | total_pages=None):
32 | super().__init__([])
33 | self.number = number
34 | self.size = size
35 | self.total_elements = total_elements
36 | self.total_pages = total_pages
37 |
38 | @staticmethod
39 | def from_json(json_obj):
40 | """Instantiate and return a Page(list)"""
41 | pg = Page()
42 | pg.json = json_obj
43 | _assign_links(pg, json_obj, ticketpy.ApiClient.root_url)
44 | pg.number = json_obj['page']['number']
45 | pg.size = json_obj['page']['size']
46 | pg.total_pages = json_obj['page']['totalPages']
47 | pg.total_elements = json_obj['page']['totalElements']
48 |
49 | embedded = json_obj.get('_embedded')
50 | if not embedded:
51 | return pg
52 |
53 | object_models = {
54 | 'events': Event,
55 | 'venues': Venue,
56 | 'attractions': Attraction,
57 | 'classifications': Classification
58 | }
59 | for k, v in embedded.items():
60 | if k in object_models:
61 | obj_type = object_models[k]
62 | pg += [obj_type.from_json(obj) for obj in v]
63 |
64 | return pg
65 |
66 | def __str__(self):
67 | return (
68 | "Page {number}/{total_pages}, "
69 | "Size: {size}, "
70 | "Total elements: {total_elements}"
71 | ).format(**self.__dict__)
72 |
73 |
74 | class Event:
75 | """Ticketmaster event
76 |
77 | The JSON returned from the Discovery API (at least, as far as
78 | what's being used here) looks like:
79 |
80 | .. code-block:: json
81 |
82 | {
83 | "name": "Event name",
84 | "dates": {
85 | "start": {
86 | "localDate": "2019-04-01",
87 | "localTime": "2019-04-01T23:00:00Z"
88 | },
89 | "status": {
90 | "code": "onsale"
91 | }
92 | },
93 | "classifications": [
94 | {
95 | "genre": {
96 | "name": "Rock"
97 | }
98 | },
99 | {
100 | "genre": {
101 | "name": "Funk"
102 | }
103 | }
104 | ],
105 | "priceRanges": [
106 | {
107 | "min": 10,
108 | "max": 25
109 | }
110 | ],
111 | "_embedded": {
112 | "venues": [
113 | {
114 | "name": "The Tabernacle"
115 | }
116 | ]
117 | }
118 | }
119 | """
120 |
121 | def __init__(self, event_id=None, name=None, start_date=None,
122 | start_time=None, status=None, price_ranges=None,
123 | venues=None, utc_datetime=None, classifications=None,
124 | links=None):
125 | self.id = event_id
126 | self.name = name
127 | #: **Local** start date (*YYYY-MM-DD*)
128 | self.local_start_date = start_date
129 | #: **Local** start time (*HH:MM:SS*)
130 | self.local_start_time = start_time
131 | #: Sale status (such as *Cancelled, Offsale...*)
132 | self.status = status
133 | self.classifications = classifications
134 | self.price_ranges = price_ranges
135 | self.venues = venues
136 | self.links = links
137 | self.__utc_datetime = None
138 | if utc_datetime is not None:
139 | self.utc_datetime = utc_datetime
140 |
141 | @property
142 | def utc_datetime(self):
143 | """Start date/time in UTC (*YYYY-MM-DDTHH:MM:SSZ*)"""
144 | return self.__utc_datetime
145 |
146 | @utc_datetime.setter
147 | def utc_datetime(self, utc_datetime):
148 | if not utc_datetime:
149 | self.__utc_datetime = None
150 | else:
151 | ts_format = "%Y-%m-%dT%H:%M:%SZ"
152 | self.__utc_datetime = datetime.strptime(utc_datetime, ts_format)
153 |
154 | @staticmethod
155 | def from_json(json_event):
156 | """Creates an ``Event`` from API's JSON response"""
157 | e = Event()
158 | e.json = json_event
159 | e.id = json_event.get('id')
160 | e.name = json_event.get('name')
161 |
162 | dates = json_event.get('dates', {})
163 | start_dates = dates.get('start', {})
164 | e.local_start_date = start_dates.get('localDate')
165 | e.local_start_time = start_dates.get('localTime')
166 | e.utc_datetime = start_dates.get('dateTime')
167 |
168 | status = dates.get('status', {})
169 | e.status = status.get('code')
170 |
171 | if 'classifications' in json_event:
172 | e.classifications = [EventClassification.from_json(cl)
173 | for cl in json_event['classifications']]
174 |
175 | price_ranges = []
176 | if 'priceRanges' in json_event:
177 | for pr in json_event['priceRanges']:
178 | pr_dict = {}
179 | if 'min' in pr:
180 | pr_dict['min'] = pr['min']
181 | if 'max' in pr:
182 | pr_dict['max'] = pr['max']
183 | price_ranges.append(pr_dict)
184 | e.price_ranges = price_ranges
185 |
186 | venues = []
187 | if 'venues' in json_event.get('_embedded', {}):
188 | for v in json_event['_embedded']['venues']:
189 | venues.append(Venue.from_json(v))
190 | e.venues = venues
191 | _assign_links(e, json_event)
192 | return e
193 |
194 | def __str__(self):
195 | tmpl = ("Event: {name}\n"
196 | "Venues: {venues}\n"
197 | "Start date: {local_start_date}\n"
198 | "Start time: {local_start_time}\n"
199 | "Price ranges: {price_ranges}\n"
200 | "Status: {status}\n"
201 | "Classifications: {classifications!s}\n")
202 | return tmpl.format(**self.__dict__)
203 |
204 |
205 | class Venue:
206 | """A Ticketmaster venue
207 |
208 | The JSON returned from the Discovery API looks something like this
209 | (*edited for brevity*):
210 |
211 | .. code-block:: json
212 |
213 | {
214 | "id": "KovZpaFEZe",
215 | "name": "The Tabernacle",
216 | "url": "http://www.ticketmaster.com/venue/115031",
217 | "timezone": "America/New_York",
218 | "address": {
219 | "line1": "152 Luckie Street"
220 | },
221 | "city": {
222 | "name": "Atlanta"
223 | },
224 | "postalCode": "30303",
225 | "state": {
226 | "stateCode": "GA",
227 | "name": "Georgia"
228 | },
229 | "country": {
230 | "name": "United States Of America",
231 | "countryCode": "US"
232 | },
233 | "location": {
234 | "latitude": "33.758688",
235 | "longitude": "-84.391449"
236 | },
237 | "social": {
238 | "twitter": {
239 | "handle": "@TabernacleATL"
240 | }
241 | },
242 | "markets": [
243 | {
244 | "id": "10"
245 | }
246 | ]
247 | }
248 |
249 |
250 | """
251 | def __init__(self, name=None, address=None, city=None, state_code=None,
252 | postal_code=None, latitude=None, longitude=None,
253 | markets=None, url=None, box_office_info=None,
254 | dmas=None, general_info=None, venue_id=None,
255 | social=None, timezone=None, images=None,
256 | parking_detail=None, accessible_seating_detail=None,
257 | links=None):
258 | self.name = name
259 | self.id = venue_id
260 | self.address = address
261 | self.postal_code = postal_code
262 | self.city = city
263 | #: State code (ex: 'GA' not 'Georgia')
264 | self.state_code = state_code
265 | self.latitude = latitude
266 | self.longitude = longitude
267 | self.timezone = timezone
268 | self.url = url
269 | self.box_office_info = box_office_info
270 | self.dmas = dmas
271 | self.markets = markets
272 | self.general_info = general_info
273 | self.social = social
274 | self.images = images
275 | self.parking_detail = parking_detail
276 | self.accessible_seating_detail = accessible_seating_detail
277 | self.links = links
278 |
279 | @property
280 | def location(self):
281 | """Location-based data (full address, lat/lon, timezone"""
282 | return {
283 | 'address': self.address,
284 | 'postal_code': self.postal_code,
285 | 'city': self.city,
286 | 'state_code': self.state_code,
287 | 'timezone': self.timezone,
288 | 'latitude': self.latitude,
289 | 'longitude': self.longitude
290 | }
291 |
292 | @staticmethod
293 | def from_json(json_venue):
294 | """Returns a ``Venue`` object from JSON"""
295 | v = Venue()
296 | v.json = json_venue
297 | v.id = json_venue.get('id')
298 | v.name = json_venue.get('name')
299 | v.url = json_venue.get('url')
300 | v.postal_code = json_venue.get('postalCode')
301 | v.general_info = json_venue.get('generalInfo')
302 | v.box_office_info = json_venue.get('boxOfficeInfo')
303 | v.dmas = json_venue.get('dmas')
304 | v.social = json_venue.get('social')
305 | v.timezone = json_venue.get('timezone')
306 | v.images = json_venue.get('images')
307 | v.parking_detail = json_venue.get('parkingDetail')
308 | v.accessible_seating_detail = json_venue.get('accessibleSeatingDetail')
309 |
310 | if 'markets' in json_venue:
311 | v.markets = [m.get('id') for m in json_venue.get('markets')]
312 | if 'city' in json_venue:
313 | v.city = json_venue['city'].get('name')
314 | if 'address' in json_venue:
315 | v.address = json_venue['address'].get('line1')
316 | if 'location' in json_venue:
317 | v.latitude = json_venue['location'].get('latitude')
318 | v.longitude = json_venue['location'].get('longitude')
319 | if 'state' in json_venue:
320 | v.state_code = json_venue['state'].get('stateCode')
321 |
322 | _assign_links(v, json_venue)
323 | return v
324 |
325 | def __str__(self):
326 | return ("{name} at {address} in "
327 | "{city} {state_code}").format(**self.__dict__)
328 |
329 |
330 | class Attraction:
331 | """Attraction"""
332 | def __init__(self, attraction_id=None, attraction_name=None, url=None,
333 | classifications=None, images=None, test=None, links=None):
334 | self.id = attraction_id
335 | self.name = attraction_name
336 | self.url = url
337 | self.classifications = classifications
338 | self.images = images
339 | self.test = test
340 | self.links = links
341 |
342 | @staticmethod
343 | def from_json(json_obj):
344 | """Convert JSON object to ``Attraction`` object"""
345 | att = Attraction()
346 | att.json = json_obj
347 | att.id = json_obj.get('id')
348 | att.name = json_obj.get('name')
349 | att.url = json_obj.get('url')
350 | att.test = json_obj.get('test')
351 | att.images = json_obj.get('images')
352 | classifications = json_obj.get('classifications')
353 | att.classifications = [
354 | Classification.from_json(cl) for cl in classifications
355 | ]
356 |
357 | _assign_links(att, json_obj)
358 | return att
359 |
360 | def __str__(self):
361 | return str(self.name) if self.name is not None else 'Unknown'
362 |
363 |
364 | class Classification:
365 | """Classification object (segment/genre/sub-genre)
366 |
367 | For the structure returned by ``EventSearch``, see ``EventClassification``
368 | """
369 | def __init__(self, segment=None, classification_type=None, subtype=None,
370 | primary=None, links=None):
371 | self.segment = segment
372 | self.type = classification_type
373 | self.subtype = subtype
374 | self.primary = primary
375 | self.links = links
376 |
377 | @staticmethod
378 | def from_json(json_obj):
379 | """Create/return ``Classification`` object from JSON"""
380 | cl = Classification()
381 | cl.json = json_obj
382 | cl.primary = json_obj.get('primary')
383 |
384 | if 'segment' in json_obj:
385 | cl.segment = Segment.from_json(json_obj['segment'])
386 |
387 | if 'type' in json_obj:
388 | cl_t = json_obj['type']
389 | cl.type = ClassificationType(cl_t['id'], cl_t['name'])
390 |
391 | if 'subType' in json_obj:
392 | cl_st = json_obj['subType']
393 | cl.subtype = ClassificationSubType(cl_st['id'], cl_st['name'])
394 |
395 | _assign_links(cl, json_obj)
396 | return cl
397 |
398 | def __str__(self):
399 | return str(self.type)
400 |
401 |
402 | class EventClassification:
403 | """Classification as it's represented in event search results
404 |
405 | See ``Classification()`` for results from classification searches
406 | """
407 | def __init__(self, genre=None, subgenre=None, segment=None,
408 | classification_type=None, classification_subtype=None,
409 | primary=None, links=None):
410 | self.genre = genre
411 | self.subgenre = subgenre
412 | self.segment = segment
413 | self.type = classification_type
414 | self.subtype = classification_subtype
415 | self.primary = primary
416 | self.links = links
417 |
418 | @staticmethod
419 | def from_json(json_obj):
420 | """Create/return ``EventClassification`` object from JSON"""
421 | ec = EventClassification()
422 | ec.json = json_obj
423 | ec.primary = json_obj.get('primary')
424 |
425 | segment = json_obj.get('segment')
426 | if segment:
427 | ec.segment = Segment.from_json(segment)
428 |
429 | genre = json_obj.get('genre')
430 | if genre:
431 | ec.genre = Genre.from_json(genre)
432 |
433 | subgenre = json_obj.get('subGenre')
434 | if subgenre:
435 | ec.subgenre = SubGenre.from_json(subgenre)
436 |
437 | cl_t = json_obj.get('type')
438 | if cl_t:
439 | ec.type = ClassificationType(cl_t['id'], cl_t['name'])
440 |
441 | cl_st = json_obj.get('subType')
442 | if cl_st:
443 | ec.subtype = ClassificationSubType(cl_st['id'], cl_st['name'])
444 |
445 | _assign_links(ec, json_obj)
446 | return ec
447 |
448 | def __str__(self):
449 | return ("Segment: {segment} / "
450 | "Genre: {genre} / "
451 | "Subgenre: {subgenre} / "
452 | "Type: {type} / "
453 | "Subtype: {subtype}").format(**self.__dict__)
454 |
455 |
456 | class ClassificationType:
457 | def __init__(self, type_id=None, type_name=None, subtypes=None):
458 | self.id = type_id
459 | self.name = type_name
460 | self.subtypes = subtypes
461 |
462 | def __str__(self):
463 | return self.name if self.name is not None else 'Unknown'
464 |
465 |
466 | class ClassificationSubType:
467 | def __init__(self, type_id=None, type_name=None):
468 | self.id = type_id
469 | self.name = type_name
470 |
471 | def __str__(self):
472 | return self.name if self.name is not None else 'Unknown'
473 |
474 |
475 | class Segment:
476 | def __init__(self, segment_id=None, segment_name=None, genres=None,
477 | links=None):
478 | self.id = segment_id
479 | self.name = segment_name
480 | self.genres = genres
481 | self.links = links
482 |
483 | @staticmethod
484 | def from_json(json_obj):
485 | """Create and return a ``Segment`` from JSON"""
486 | seg = Segment()
487 | seg.json = json_obj
488 | seg.id = json_obj['id']
489 | seg.name = json_obj.get('name')
490 |
491 | if '_embedded' in json_obj:
492 | genres = json_obj['_embedded']['genres']
493 | seg.genres = [Genre.from_json(g) for g in genres]
494 |
495 | _assign_links(seg, json_obj)
496 | return seg
497 |
498 | def __str__(self):
499 | return self.name if self.name is not None else 'Unknown'
500 |
501 |
502 | class Genre:
503 | def __init__(self, genre_id=None, genre_name=None, subgenres=None,
504 | links=None):
505 | self.id = genre_id
506 | self.name = genre_name
507 | self.subgenres = subgenres
508 | self.links = links
509 |
510 | @staticmethod
511 | def from_json(json_obj):
512 | g = Genre()
513 | g.json = json_obj
514 | g.id = json_obj.get('id')
515 | g.name = json_obj.get('name')
516 | if '_embedded' in json_obj:
517 | embedded = json_obj['_embedded']
518 | subgenres = embedded['subgenres']
519 | g.subgenres = [SubGenre.from_json(sg) for sg in subgenres]
520 |
521 | _assign_links(g, json_obj)
522 | return g
523 |
524 | def __str__(self):
525 | return self.name if self.name is not None else 'Unknown'
526 |
527 |
528 | class SubGenre:
529 | def __init__(self, subgenre_id=None, subgenre_name=None, links=None):
530 | self.id = subgenre_id
531 | self.name = subgenre_name
532 | self.links = links
533 |
534 | @staticmethod
535 | def from_json(json_obj):
536 | sg = SubGenre()
537 | sg.json = json_obj
538 | sg.id = json_obj['id']
539 | sg.name = json_obj['name']
540 | _assign_links(sg, json_obj)
541 | return sg
542 |
543 | def __str__(self):
544 | return self.name if self.name is not None else 'Unknown'
545 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/searchtools.js:
--------------------------------------------------------------------------------
1 | /*
2 | * searchtools.js_t
3 | * ~~~~~~~~~~~~~~~~
4 | *
5 | * Sphinx JavaScript utilities for the full-text search.
6 | *
7 | * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 |
13 | /* Non-minified version JS is _stemmer.js if file is provided */
14 | /**
15 | * Porter Stemmer
16 | */
17 | var Stemmer = function() {
18 |
19 | var step2list = {
20 | ational: 'ate',
21 | tional: 'tion',
22 | enci: 'ence',
23 | anci: 'ance',
24 | izer: 'ize',
25 | bli: 'ble',
26 | alli: 'al',
27 | entli: 'ent',
28 | eli: 'e',
29 | ousli: 'ous',
30 | ization: 'ize',
31 | ation: 'ate',
32 | ator: 'ate',
33 | alism: 'al',
34 | iveness: 'ive',
35 | fulness: 'ful',
36 | ousness: 'ous',
37 | aliti: 'al',
38 | iviti: 'ive',
39 | biliti: 'ble',
40 | logi: 'log'
41 | };
42 |
43 | var step3list = {
44 | icate: 'ic',
45 | ative: '',
46 | alize: 'al',
47 | iciti: 'ic',
48 | ical: 'ic',
49 | ful: '',
50 | ness: ''
51 | };
52 |
53 | var c = "[^aeiou]"; // consonant
54 | var v = "[aeiouy]"; // vowel
55 | var C = c + "[^aeiouy]*"; // consonant sequence
56 | var V = v + "[aeiou]*"; // vowel sequence
57 |
58 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
59 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
60 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
61 | var s_v = "^(" + C + ")?" + v; // vowel in stem
62 |
63 | this.stemWord = function (w) {
64 | var stem;
65 | var suffix;
66 | var firstch;
67 | var origword = w;
68 |
69 | if (w.length < 3)
70 | return w;
71 |
72 | var re;
73 | var re2;
74 | var re3;
75 | var re4;
76 |
77 | firstch = w.substr(0,1);
78 | if (firstch == "y")
79 | w = firstch.toUpperCase() + w.substr(1);
80 |
81 | // Step 1a
82 | re = /^(.+?)(ss|i)es$/;
83 | re2 = /^(.+?)([^s])s$/;
84 |
85 | if (re.test(w))
86 | w = w.replace(re,"$1$2");
87 | else if (re2.test(w))
88 | w = w.replace(re2,"$1$2");
89 |
90 | // Step 1b
91 | re = /^(.+?)eed$/;
92 | re2 = /^(.+?)(ed|ing)$/;
93 | if (re.test(w)) {
94 | var fp = re.exec(w);
95 | re = new RegExp(mgr0);
96 | if (re.test(fp[1])) {
97 | re = /.$/;
98 | w = w.replace(re,"");
99 | }
100 | }
101 | else if (re2.test(w)) {
102 | var fp = re2.exec(w);
103 | stem = fp[1];
104 | re2 = new RegExp(s_v);
105 | if (re2.test(stem)) {
106 | w = stem;
107 | re2 = /(at|bl|iz)$/;
108 | re3 = new RegExp("([^aeiouylsz])\\1$");
109 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
110 | if (re2.test(w))
111 | w = w + "e";
112 | else if (re3.test(w)) {
113 | re = /.$/;
114 | w = w.replace(re,"");
115 | }
116 | else if (re4.test(w))
117 | w = w + "e";
118 | }
119 | }
120 |
121 | // Step 1c
122 | re = /^(.+?)y$/;
123 | if (re.test(w)) {
124 | var fp = re.exec(w);
125 | stem = fp[1];
126 | re = new RegExp(s_v);
127 | if (re.test(stem))
128 | w = stem + "i";
129 | }
130 |
131 | // Step 2
132 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
133 | if (re.test(w)) {
134 | var fp = re.exec(w);
135 | stem = fp[1];
136 | suffix = fp[2];
137 | re = new RegExp(mgr0);
138 | if (re.test(stem))
139 | w = stem + step2list[suffix];
140 | }
141 |
142 | // Step 3
143 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
144 | if (re.test(w)) {
145 | var fp = re.exec(w);
146 | stem = fp[1];
147 | suffix = fp[2];
148 | re = new RegExp(mgr0);
149 | if (re.test(stem))
150 | w = stem + step3list[suffix];
151 | }
152 |
153 | // Step 4
154 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
155 | re2 = /^(.+?)(s|t)(ion)$/;
156 | if (re.test(w)) {
157 | var fp = re.exec(w);
158 | stem = fp[1];
159 | re = new RegExp(mgr1);
160 | if (re.test(stem))
161 | w = stem;
162 | }
163 | else if (re2.test(w)) {
164 | var fp = re2.exec(w);
165 | stem = fp[1] + fp[2];
166 | re2 = new RegExp(mgr1);
167 | if (re2.test(stem))
168 | w = stem;
169 | }
170 |
171 | // Step 5
172 | re = /^(.+?)e$/;
173 | if (re.test(w)) {
174 | var fp = re.exec(w);
175 | stem = fp[1];
176 | re = new RegExp(mgr1);
177 | re2 = new RegExp(meq1);
178 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
179 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
180 | w = stem;
181 | }
182 | re = /ll$/;
183 | re2 = new RegExp(mgr1);
184 | if (re.test(w) && re2.test(w)) {
185 | re = /.$/;
186 | w = w.replace(re,"");
187 | }
188 |
189 | // and turn initial Y back to y
190 | if (firstch == "y")
191 | w = firstch.toLowerCase() + w.substr(1);
192 | return w;
193 | }
194 | }
195 |
196 |
197 |
198 | /**
199 | * Simple result scoring code.
200 | */
201 | var Scorer = {
202 | // Implement the following function to further tweak the score for each result
203 | // The function takes a result array [filename, title, anchor, descr, score]
204 | // and returns the new score.
205 | /*
206 | score: function(result) {
207 | return result[4];
208 | },
209 | */
210 |
211 | // query matches the full name of an object
212 | objNameMatch: 11,
213 | // or matches in the last dotted part of the object name
214 | objPartialMatch: 6,
215 | // Additive scores depending on the priority of the object
216 | objPrio: {0: 15, // used to be importantResults
217 | 1: 5, // used to be objectResults
218 | 2: -5}, // used to be unimportantResults
219 | // Used when the priority is not in the mapping.
220 | objPrioDefault: 0,
221 |
222 | // query found in title
223 | title: 15,
224 | // query found in terms
225 | term: 5
226 | };
227 |
228 |
229 |
230 |
231 |
232 | var splitChars = (function() {
233 | var result = {};
234 | var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648,
235 | 1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702,
236 | 2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971,
237 | 2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345,
238 | 3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761,
239 | 3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823,
240 | 4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125,
241 | 8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695,
242 | 11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587,
243 | 43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141];
244 | var i, j, start, end;
245 | for (i = 0; i < singles.length; i++) {
246 | result[singles[i]] = true;
247 | }
248 | var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709],
249 | [722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161],
250 | [1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568],
251 | [1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807],
252 | [1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047],
253 | [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383],
254 | [2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450],
255 | [2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547],
256 | [2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673],
257 | [2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820],
258 | [2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946],
259 | [2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023],
260 | [3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173],
261 | [3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332],
262 | [3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481],
263 | [3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718],
264 | [3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791],
265 | [3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095],
266 | [4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205],
267 | [4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687],
268 | [4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968],
269 | [4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869],
270 | [5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102],
271 | [6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271],
272 | [6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592],
273 | [6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822],
274 | [6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167],
275 | [7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959],
276 | [7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143],
277 | [8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318],
278 | [8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483],
279 | [8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101],
280 | [10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567],
281 | [11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292],
282 | [12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444],
283 | [12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783],
284 | [12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311],
285 | [19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511],
286 | [42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774],
287 | [42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071],
288 | [43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263],
289 | [43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519],
290 | [43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647],
291 | [43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967],
292 | [44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295],
293 | [57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274],
294 | [64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007],
295 | [65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381],
296 | [65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]];
297 | for (i = 0; i < ranges.length; i++) {
298 | start = ranges[i][0];
299 | end = ranges[i][1];
300 | for (j = start; j <= end; j++) {
301 | result[j] = true;
302 | }
303 | }
304 | return result;
305 | })();
306 |
307 | function splitQuery(query) {
308 | var result = [];
309 | var start = -1;
310 | for (var i = 0; i < query.length; i++) {
311 | if (splitChars[query.charCodeAt(i)]) {
312 | if (start !== -1) {
313 | result.push(query.slice(start, i));
314 | start = -1;
315 | }
316 | } else if (start === -1) {
317 | start = i;
318 | }
319 | }
320 | if (start !== -1) {
321 | result.push(query.slice(start));
322 | }
323 | return result;
324 | }
325 |
326 |
327 |
328 |
329 | /**
330 | * Search Module
331 | */
332 | var Search = {
333 |
334 | _index : null,
335 | _queued_query : null,
336 | _pulse_status : -1,
337 |
338 | init : function() {
339 | var params = $.getQueryParameters();
340 | if (params.q) {
341 | var query = params.q[0];
342 | $('input[name="q"]')[0].value = query;
343 | this.performSearch(query);
344 | }
345 | },
346 |
347 | loadIndex : function(url) {
348 | $.ajax({type: "GET", url: url, data: null,
349 | dataType: "script", cache: true,
350 | complete: function(jqxhr, textstatus) {
351 | if (textstatus != "success") {
352 | document.getElementById("searchindexloader").src = url;
353 | }
354 | }});
355 | },
356 |
357 | setIndex : function(index) {
358 | var q;
359 | this._index = index;
360 | if ((q = this._queued_query) !== null) {
361 | this._queued_query = null;
362 | Search.query(q);
363 | }
364 | },
365 |
366 | hasIndex : function() {
367 | return this._index !== null;
368 | },
369 |
370 | deferQuery : function(query) {
371 | this._queued_query = query;
372 | },
373 |
374 | stopPulse : function() {
375 | this._pulse_status = 0;
376 | },
377 |
378 | startPulse : function() {
379 | if (this._pulse_status >= 0)
380 | return;
381 | function pulse() {
382 | var i;
383 | Search._pulse_status = (Search._pulse_status + 1) % 4;
384 | var dotString = '';
385 | for (i = 0; i < Search._pulse_status; i++)
386 | dotString += '.';
387 | Search.dots.text(dotString);
388 | if (Search._pulse_status > -1)
389 | window.setTimeout(pulse, 500);
390 | }
391 | pulse();
392 | },
393 |
394 | /**
395 | * perform a search for something (or wait until index is loaded)
396 | */
397 | performSearch : function(query) {
398 | // create the required interface elements
399 | this.out = $('#search-results');
400 | this.title = $('' + _('Searching') + ' ').appendTo(this.out);
401 | this.dots = $(' ').appendTo(this.title);
402 | this.status = $('
').appendTo(this.out);
403 | this.output = $('').appendTo(this.out);
404 |
405 | $('#search-progress').text(_('Preparing search...'));
406 | this.startPulse();
407 |
408 | // index already loaded, the browser was quick!
409 | if (this.hasIndex())
410 | this.query(query);
411 | else
412 | this.deferQuery(query);
413 | },
414 |
415 | /**
416 | * execute search (requires search index to be loaded)
417 | */
418 | query : function(query) {
419 | var i;
420 | var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
421 |
422 | // stem the searchterms and add them to the correct list
423 | var stemmer = new Stemmer();
424 | var searchterms = [];
425 | var excluded = [];
426 | var hlterms = [];
427 | var tmp = splitQuery(query);
428 | var objectterms = [];
429 | for (i = 0; i < tmp.length; i++) {
430 | if (tmp[i] !== "") {
431 | objectterms.push(tmp[i].toLowerCase());
432 | }
433 |
434 | if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
435 | tmp[i] === "") {
436 | // skip this "word"
437 | continue;
438 | }
439 | // stem the word
440 | var word = stemmer.stemWord(tmp[i].toLowerCase());
441 | // prevent stemmer from cutting word smaller than two chars
442 | if(word.length < 3 && tmp[i].length >= 3) {
443 | word = tmp[i];
444 | }
445 | var toAppend;
446 | // select the correct list
447 | if (word[0] == '-') {
448 | toAppend = excluded;
449 | word = word.substr(1);
450 | }
451 | else {
452 | toAppend = searchterms;
453 | hlterms.push(tmp[i].toLowerCase());
454 | }
455 | // only add if not already in the list
456 | if (!$u.contains(toAppend, word))
457 | toAppend.push(word);
458 | }
459 | var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
460 |
461 | // console.debug('SEARCH: searching for:');
462 | // console.info('required: ', searchterms);
463 | // console.info('excluded: ', excluded);
464 |
465 | // prepare search
466 | var terms = this._index.terms;
467 | var titleterms = this._index.titleterms;
468 |
469 | // array of [filename, title, anchor, descr, score]
470 | var results = [];
471 | $('#search-progress').empty();
472 |
473 | // lookup as object
474 | for (i = 0; i < objectterms.length; i++) {
475 | var others = [].concat(objectterms.slice(0, i),
476 | objectterms.slice(i+1, objectterms.length));
477 | results = results.concat(this.performObjectSearch(objectterms[i], others));
478 | }
479 |
480 | // lookup as search terms in fulltext
481 | results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
482 |
483 | // let the scorer override scores with a custom scoring function
484 | if (Scorer.score) {
485 | for (i = 0; i < results.length; i++)
486 | results[i][4] = Scorer.score(results[i]);
487 | }
488 |
489 | // now sort the results by score (in opposite order of appearance, since the
490 | // display function below uses pop() to retrieve items) and then
491 | // alphabetically
492 | results.sort(function(a, b) {
493 | var left = a[4];
494 | var right = b[4];
495 | if (left > right) {
496 | return 1;
497 | } else if (left < right) {
498 | return -1;
499 | } else {
500 | // same score: sort alphabetically
501 | left = a[1].toLowerCase();
502 | right = b[1].toLowerCase();
503 | return (left > right) ? -1 : ((left < right) ? 1 : 0);
504 | }
505 | });
506 |
507 | // for debugging
508 | //Search.lastresults = results.slice(); // a copy
509 | //console.info('search results:', Search.lastresults);
510 |
511 | // print the results
512 | var resultCount = results.length;
513 | function displayNextItem() {
514 | // results left, load the summary and display it
515 | if (results.length) {
516 | var item = results.pop();
517 | var listItem = $(' ');
518 | if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
519 | // dirhtml builder
520 | var dirname = item[0] + '/';
521 | if (dirname.match(/\/index\/$/)) {
522 | dirname = dirname.substring(0, dirname.length-6);
523 | } else if (dirname == 'index/') {
524 | dirname = '';
525 | }
526 | listItem.append($(' ').attr('href',
527 | DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
528 | highlightstring + item[2]).html(item[1]));
529 | } else {
530 | // normal html builders
531 | listItem.append($(' ').attr('href',
532 | item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
533 | highlightstring + item[2]).html(item[1]));
534 | }
535 | if (item[3]) {
536 | listItem.append($(' (' + item[3] + ') '));
537 | Search.output.append(listItem);
538 | listItem.slideDown(5, function() {
539 | displayNextItem();
540 | });
541 | } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
542 | var suffix = DOCUMENTATION_OPTIONS.SOURCELINK_SUFFIX;
543 | $.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].slice(-suffix.length) === suffix ? '' : suffix),
544 | dataType: "text",
545 | complete: function(jqxhr, textstatus) {
546 | var data = jqxhr.responseText;
547 | if (data !== '' && data !== undefined) {
548 | listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
549 | }
550 | Search.output.append(listItem);
551 | listItem.slideDown(5, function() {
552 | displayNextItem();
553 | });
554 | }});
555 | } else {
556 | // no source available, just display title
557 | Search.output.append(listItem);
558 | listItem.slideDown(5, function() {
559 | displayNextItem();
560 | });
561 | }
562 | }
563 | // search finished, update title and status message
564 | else {
565 | Search.stopPulse();
566 | Search.title.text(_('Search Results'));
567 | if (!resultCount)
568 | Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
569 | else
570 | Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
571 | Search.status.fadeIn(500);
572 | }
573 | }
574 | displayNextItem();
575 | },
576 |
577 | /**
578 | * search for object names
579 | */
580 | performObjectSearch : function(object, otherterms) {
581 | var filenames = this._index.filenames;
582 | var docnames = this._index.docnames;
583 | var objects = this._index.objects;
584 | var objnames = this._index.objnames;
585 | var titles = this._index.titles;
586 |
587 | var i;
588 | var results = [];
589 |
590 | for (var prefix in objects) {
591 | for (var name in objects[prefix]) {
592 | var fullname = (prefix ? prefix + '.' : '') + name;
593 | if (fullname.toLowerCase().indexOf(object) > -1) {
594 | var score = 0;
595 | var parts = fullname.split('.');
596 | // check for different match types: exact matches of full name or
597 | // "last name" (i.e. last dotted part)
598 | if (fullname == object || parts[parts.length - 1] == object) {
599 | score += Scorer.objNameMatch;
600 | // matches in last name
601 | } else if (parts[parts.length - 1].indexOf(object) > -1) {
602 | score += Scorer.objPartialMatch;
603 | }
604 | var match = objects[prefix][name];
605 | var objname = objnames[match[1]][2];
606 | var title = titles[match[0]];
607 | // If more than one term searched for, we require other words to be
608 | // found in the name/title/description
609 | if (otherterms.length > 0) {
610 | var haystack = (prefix + ' ' + name + ' ' +
611 | objname + ' ' + title).toLowerCase();
612 | var allfound = true;
613 | for (i = 0; i < otherterms.length; i++) {
614 | if (haystack.indexOf(otherterms[i]) == -1) {
615 | allfound = false;
616 | break;
617 | }
618 | }
619 | if (!allfound) {
620 | continue;
621 | }
622 | }
623 | var descr = objname + _(', in ') + title;
624 |
625 | var anchor = match[3];
626 | if (anchor === '')
627 | anchor = fullname;
628 | else if (anchor == '-')
629 | anchor = objnames[match[1]][1] + '-' + fullname;
630 | // add custom score for some objects according to scorer
631 | if (Scorer.objPrio.hasOwnProperty(match[2])) {
632 | score += Scorer.objPrio[match[2]];
633 | } else {
634 | score += Scorer.objPrioDefault;
635 | }
636 | results.push([docnames[match[0]], fullname, '#'+anchor, descr, score, filenames[match[0]]]);
637 | }
638 | }
639 | }
640 |
641 | return results;
642 | },
643 |
644 | /**
645 | * search for full-text terms in the index
646 | */
647 | performTermsSearch : function(searchterms, excluded, terms, titleterms) {
648 | var docnames = this._index.docnames;
649 | var filenames = this._index.filenames;
650 | var titles = this._index.titles;
651 |
652 | var i, j, file;
653 | var fileMap = {};
654 | var scoreMap = {};
655 | var results = [];
656 |
657 | // perform the search on the required terms
658 | for (i = 0; i < searchterms.length; i++) {
659 | var word = searchterms[i];
660 | var files = [];
661 | var _o = [
662 | {files: terms[word], score: Scorer.term},
663 | {files: titleterms[word], score: Scorer.title}
664 | ];
665 |
666 | // no match but word was a required one
667 | if ($u.every(_o, function(o){return o.files === undefined;})) {
668 | break;
669 | }
670 | // found search word in contents
671 | $u.each(_o, function(o) {
672 | var _files = o.files;
673 | if (_files === undefined)
674 | return
675 |
676 | if (_files.length === undefined)
677 | _files = [_files];
678 | files = files.concat(_files);
679 |
680 | // set score for the word in each file to Scorer.term
681 | for (j = 0; j < _files.length; j++) {
682 | file = _files[j];
683 | if (!(file in scoreMap))
684 | scoreMap[file] = {}
685 | scoreMap[file][word] = o.score;
686 | }
687 | });
688 |
689 | // create the mapping
690 | for (j = 0; j < files.length; j++) {
691 | file = files[j];
692 | if (file in fileMap)
693 | fileMap[file].push(word);
694 | else
695 | fileMap[file] = [word];
696 | }
697 | }
698 |
699 | // now check if the files don't contain excluded terms
700 | for (file in fileMap) {
701 | var valid = true;
702 |
703 | // check if all requirements are matched
704 | if (fileMap[file].length != searchterms.length)
705 | continue;
706 |
707 | // ensure that none of the excluded terms is in the search result
708 | for (i = 0; i < excluded.length; i++) {
709 | if (terms[excluded[i]] == file ||
710 | titleterms[excluded[i]] == file ||
711 | $u.contains(terms[excluded[i]] || [], file) ||
712 | $u.contains(titleterms[excluded[i]] || [], file)) {
713 | valid = false;
714 | break;
715 | }
716 | }
717 |
718 | // if we have still a valid result we can add it to the result list
719 | if (valid) {
720 | // select one (max) score for the file.
721 | // for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
722 | var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
723 | results.push([docnames[file], titles[file], '', null, score, filenames[file]]);
724 | }
725 | }
726 | return results;
727 | },
728 |
729 | /**
730 | * helper function to return a node containing the
731 | * search summary for a given text. keywords is a list
732 | * of stemmed words, hlwords is the list of normal, unstemmed
733 | * words. the first one is used to find the occurrence, the
734 | * latter for highlighting it.
735 | */
736 | makeSearchSummary : function(text, keywords, hlwords) {
737 | var textLower = text.toLowerCase();
738 | var start = 0;
739 | $.each(keywords, function() {
740 | var i = textLower.indexOf(this.toLowerCase());
741 | if (i > -1)
742 | start = i;
743 | });
744 | start = Math.max(start - 120, 0);
745 | var excerpt = ((start > 0) ? '...' : '') +
746 | $.trim(text.substr(start, 240)) +
747 | ((start + 240 - text.length) ? '...' : '');
748 | var rv = $('
').text(excerpt);
749 | $.each(hlwords, function() {
750 | rv = rv.highlightText(this, 'highlighted');
751 | });
752 | return rv;
753 | }
754 | };
755 |
756 | $(document).ready(function() {
757 | Search.init();
758 | });
--------------------------------------------------------------------------------