diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index d510c35..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,19 +0,0 @@ -languages: - Python: true -pep8: - enabled: true - checks: - E501: - enabled: false -exclude_paths: -- ".pylintrc" -- "LICENSE" -- "test/*" -- "docs/*" -- "*.in" -- "*.txt" -- "*.cfg" -- "*.rst" -- "*.ini" -- "*.yml" -- "*.*.yml" diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index 9d80dce..0000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,37 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python build - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: [pypy-3.7, 3.5, 3.6, 3.7] - os: [macos-latest, ubuntu-latest] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - python setup.py flake8 - - name: Test with pytest - run: | - python setup.py test diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml deleted file mode 100644 index 0c2afde..0000000 --- a/.github/workflows/pythonpublish.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Update PyPi - -on: - release: - types: [published] - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* diff --git a/.gitignore b/.gitignore deleted file mode 100644 index ffd5625..0000000 --- a/.gitignore +++ /dev/null @@ -1,69 +0,0 @@ -.DS_Store - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -docs/build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Virtualenv -sdk/ - -# IDE files -.project -.pydevproject -.idea -.vscode diff --git a/tests/__init__.py b/.nojekyll similarity index 100% rename from tests/__init__.py rename to .nojekyll diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f7d4787..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -dist: xenial -language: python - -branches: - only: - - master - - stable - -matrix: - fast_finish: true - include: - - python: 3.5 - script: python setup.py flake8 && python setup.py test - - python: 3.6 - script: python setup.py flake8 && python setup.py test - - python: 3.7 - script: python setup.py flake8 && python setup.py test - - python: pypy - script: python setup.py flake8 && python setup.py test - - python: pypy3 - script: python setup.py flake8 && python setup.py test \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index ad916cd..0000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,83 +0,0 @@ -Contributing Guidelines -======================= - -We love pull requests from everyone! - -We encourage community contributions for all kinds of changes both big -and small, but we ask that you adhere to the following guidelines for -contributing code. - -Proposing Changes -''''''''''''''''' - -As a starting point for all changes, we recommend `reporting an issue`_ -before you begin making any changes. Make sure to search the issues on -this repository first to check and see the issue has already been -previously discussed and whether or not it’s already being worked on. - -- For small changes, improvements and bug fixes please feel free to - send us a pull request with proposed changes along-side the issue you - report. - -- For larger more involved or design related changes, please open an - issue and discuss the changes with the other contributors before - submitting any pull requests. - -Submitting A Pull Request -''''''''''''''''''''''''' - -1) Fork us and clone the repository locally. - -.. code:: bash - - git clone git@github.com:twitterdev/twitter-python-ads-sdk.git - -2) Install development dependencies (`virtualenv recommended`_): - -.. code:: bash - - pip install -r requirements.txt - -3) Make sure all tests pass before you start: - -.. code:: bash - - python setup.py test - -4) Make your changes! (Don’t forget tests and documentation) - -5) Check style and test your changes again to make sure everything is green: - -.. code:: bash - - python setup.py flake8 && python setup.py test - -The test suite will automatically enforce test coverage and code style. -This project adhere’s fully to the `PEP-8 style guide`_ (100 character line -length allowed) and we use `Flake8`_ to enforce style and code quality. - -6) Submit your changes! - -- `Squash`_ your development commits. Put features in a single clean commit whenever possible or logically split it into a few commits (no development commits). Test coverage can be included in a separate commit if preferred. -- Write a `good commit message`_ for your change. -- Push to your fork. -- Submit a `pull request`_. - -We try to at least comment on pull requests within one business day and -may suggest changes. - -Release Schedule and Versioning -''''''''''''''''''''''''''''''' - -We have a regular release cadence and adhere to `semantic versioning`_. -When exactly your change ships will depend on the scope of your changes -and what type of upcoming release its best suited for. - -.. _reporting an issue: https://github.com/twitterdev/twitter-python-ads-sdk/issues?q=is%3Aopen+is%3Aissue -.. _PEP-8 style guide: https://www.python.org/dev/peps/pep-0008 -.. _Flake8: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/setup.cfg -.. _good commit message: http://chris.beams.io/posts/git-commit/ -.. _pull request: https://github.com/thoughtbot/suspenders/compare/ -.. _semantic versioning: http://semver.org/ -.. _virtualenv recommended: https://virtualenv.readthedocs.org -.. _Squash: http://eli.thegreenplace.net/2014/02/19/squashing-github-pull-requests-into-a-single-commit diff --git a/LICENSE b/LICENSE deleted file mode 100644 index a9deb00..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (C) 2015 Twitter, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index afbd847..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include *.rst -prune .DS_Store diff --git a/README.rst b/README.rst deleted file mode 100644 index 82f1072..0000000 --- a/README.rst +++ /dev/null @@ -1,201 +0,0 @@ -Getting Started |Build Status| |Code Climate| |PyPy Version| ------------------------------------------------------------- - -Installation -'''''''''''' - -.. code:: bash - - # installing the latest signed release - pip install twitter-ads - -Quick Start -''''''''''' - -.. code:: python - - from twitter_ads.client import Client - from twitter_ads.campaign import Campaign - from twitter_ads.enum import ENTITY_STATUS - - CONSUMER_KEY = 'your consumer key' - CONSUMER_SECRET = 'your consumer secret' - ACCESS_TOKEN = 'access token' - ACCESS_TOKEN_SECRET = 'access token secret' - ACCOUNT_ID = 'account id' - - # initialize the client - client = Client( - CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - - # load the advertiser account instance - account = client.accounts(ACCOUNT_ID) - - # load and update a specific campaign - campaign = account.campaigns().next() - campaign.name = 'updated campaign name' - campaign.entity_status = ENTITY_STATUS.PAUSED - campaign.save() - - # iterate through campaigns - for campaign in account.campaigns(): - print(campaign.id) - - - -Command Line Helper -''''''''''''''''''' - -.. code:: bash - - # The twitter-ads command launches an interactive session for testing purposes - # with a client instance automatically loaded from your .twurlrc file. - - ~ ❯ twitter-ads - -For more help please see our `Examples and Guides`_ or check the online -`Reference Documentation`_. - -Rate-limit handling and request options -''''''''''''''''''' - -.. code:: python - - client = Client( - CONSUMER_KEY, - CONSUMER_SECRET, - ACCESS_TOKEN, - ACCESS_TOKEN_SECRET, - options={ - 'handle_rate_limit': True, - 'retry_max': 3, - 'retry_delay': 5000, - 'retry_on_status': [404, 500, 503], - 'retry_on_timeouts': True, - 'timeout': (1.0, 3.0) - }) - - -.. list-table:: - - * - Parameter - - Default - - Description - * - ``handle_rate_limit`` - - ``False`` (boolean) - - Set ``True`` will check rate-limit response header and sleep if the request reached the limit (429). - * - ``retry_max`` - - ``0`` (int) - - The number of times you want to retry when response code is found in ``retry_on_status``. - * - ``retry_delay`` - - ``1500`` (int) - - The number of **milliseconds** you want to sleep before retry. - * - ``retry_on_status`` - - ``[500, 503]`` (list) - - The response codes you want to retry on. You can only set >= 400 status codes. - * - ``retry_on_timeouts`` - - ``False`` (boolean) - - Set ``True`` will catch the timeout error and retry the request. - * - ``timeout`` - - ``None`` - - You can specify either a single value OR a tuple. If a single value is specified, the timeout value will be applied to both the ``connect`` and the ``read`` timeouts. See https://2.python-requests.org/en/master/user/advanced/#timeouts for more details of the usage. - -Compatibility & Versioning --------------------------- - -This project is designed to work with Python 3.5 or greater. While it -may work on other version of Python, below are the platform and runtime -versions we officially support and regularly test against. - -+------------+-------------------------+ -| Platform | Versions | -+============+=========================+ -| CPython | 3.5, 3.6, 3.7 | -+------------+-------------------------+ -| PyPy | 7.x | -+------------+-------------------------+ - -All releases adhere to strict `semantic versioning`_. For Example, -major.minor.patch-pre (aka. stick.carrot.oops-peek). - -Development ------------ - -If you’d like to contribute to the project or try an unreleased -development version of this project locally, you can do so quite easily -by following the examples below. - -.. code:: bash - - # clone the repository - git clone git@github.com:twitterdev/twitter-python-ads-sdk.git - cd twitter-python-ads-sdk - - # install dependencies - pip install -r requirements.txt - - # installing a local unsigned release - pip install -e . - -We love community contributions! If you’re planning to send us a pull -request, please make sure read our `Contributing Guidelines`_ first. - -Feedback and Bug Reports ------------------------- - -Found an issue? Please open up a `GitHub issue`_ or even better yet -`send us`_ a pull request. Have a question? Want to discuss a new -feature? Come chat with us in the `Twitter Community Forums`_. - -Error Handling --------------- - -Like the `Response`_ and `Request`_ classes, the Ads API SDK fully models -all `error objects`_ for easy error handling. - -|error-hierarchy| - -License -------- - -The MIT License (MIT) - -Copyright (C) 2015 Twitter, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -.. _Examples and Guides: https://github.com/twitterdev/twitter-python-ads-sdk/tree/master/examples -.. _Reference Documentation: http://twitterdev.github.io/twitter-python-ads-sdk/reference/index.html -.. _semantic versioning: http://semver.org -.. _Contributing Guidelines: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/CONTRIBUTING.rst -.. _GitHub issue: https://github.com/twitterdev/twitter-python-ads-sdk/issues -.. _send us: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/CONTRIBUTING.rst -.. _Twitter Community Forums: https://twittercommunity.com/c/advertiser-api - -.. |Build Status| image:: https://travis-ci.org/twitterdev/twitter-python-ads-sdk.svg?branch=master - :target: https://travis-ci.org/twitterdev/twitter-python-ads-sdk -.. |Code Climate| image:: https://codeclimate.com/github/twitterdev/twitter-python-ads-sdk/badges/gpa.svg - :target: https://codeclimate.com/github/twitterdev/twitter-python-ads-sdk -.. |PyPy Version| image:: https://badge.fury.io/py/twitter-ads.svg - :target: http://badge.fury.io/py/twitter-ads - -.. _Request: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/twitter_ads/http.py#L28 -.. _Response: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/twitter_ads/http.py#L118 -.. _error objects: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/twitter_ads/error.py -.. |error-hierarchy| image:: http://i.imgur.com/XcLDWLO.png diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..bccdc87 --- /dev/null +++ b/_config.yml @@ -0,0 +1,3 @@ + +include: ['reference/_modules', 'reference/_sources', 'reference/_static'] + diff --git a/bin/twitter-ads b/bin/twitter-ads deleted file mode 100755 index 19db50a..0000000 --- a/bin/twitter-ads +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python - -import os -import yaml -import code -import sys -import readline -import rlcompleter -import atexit - -try: - import twitter_ads - print('[INFO] using pip installed twitter-ads.') -except ImportError: - sys.path.append(os.path.join(os.path.dirname(__file__), '..')) - import twitter_ads - print('[INFO] using local clone of twitter-ads.') - -from twitter_ads.client import Client - -CLIENT = None -BANNER = '** Twitter Ads API SDK for Python v{0} (twitter-ads) **' - -# if twurl config is present, create client instance -twurl_path = os.path.expanduser('~/.twurlrc') -if os.path.isfile(twurl_path): - with open(twurl_path, 'r') as stream: - twurl_config = yaml.load(stream) - profile_name = twurl_config['configuration']['default_profile'][0] - profile_key = twurl_config['configuration']['default_profile'][1] - default_profile = twurl_config['profiles'][profile_name][profile_key] - - CLIENT = Client(default_profile['consumer_key'], - default_profile['consumer_secret'], - default_profile['token'], - default_profile['secret']) - -# tab completion -readline.parse_and_bind('tab: complete') - -# history file -histfile = os.path.join(os.environ['HOME'], '.pythonhistory') -try: - readline.read_history_file(histfile) -except IOError: - pass -atexit.register(readline.write_history_file, histfile) -del os, histfile, readline, rlcompleter - -# start interactive session -init_with = { 'CLIENT': CLIENT } if CLIENT else {} -code.InteractiveConsole(locals=init_with).interact( - BANNER.format(twitter_ads.utils.get_version())) diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 83a2240..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,192 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = build - -# User-friendly check for sphinx-build -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) -endif - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " applehelp to make an Apple Help Book" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - @echo " coverage to run coverage check of the documentation (if enabled)" - -clean: - rm -rf $(BUILDDIR)/* - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/TwitterAdsAPISDKforPython.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/TwitterAdsAPISDKforPython.qhc" - -applehelp: - $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp - @echo - @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." - @echo "N.B. You won't be able to view it unless you put it in" \ - "~/Library/Documentation/Help or install it in your application" \ - "bundle." - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/TwitterAdsAPISDKforPython" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/TwitterAdsAPISDKforPython" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -latexpdfja: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -coverage: - $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage - @echo "Testing of coverage in the sources finished, look at the " \ - "results in $(BUILDDIR)/coverage/python.txt." - -xml: - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." - -pseudoxml: - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index 3968778..0000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,291 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Twitter Ads API SDK for Python documentation build configuration file, created by -# sphinx-quickstart on Sun Dec 6 15:03:06 2015. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os -import shlex - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('../../twitter_ads')) - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.doctest', - 'sphinx.ext.intersphinx', - 'sphinx.ext.ifconfig', - 'sphinx.ext.viewcode', -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'Twitter Ads API SDK for Python' -copyright = u'2019, Twitter, Inc' -author = u'jbabich@twitter.com, tbhushan@twitter.com, jshishido@twitter.com' - -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) -from twitter_ads.utils import get_version - -version = get_version() -release = get_version() - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = [] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = 'alabaster' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = ['_static'] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -#html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -#html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -#html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = 'TwitterAdsAPISDKforPythondoc' - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', - -# Latex figure (float) alignment -#'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'TwitterAdsAPISDKforPython.tex', u'Twitter Ads API SDK for Python Documentation', - u'jbabich@twitter.com, tbhushan@twitter.com, jshishido@twitter.com', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'twitteradsapisdkforpython', u'Twitter Ads API SDK for Python Documentation', - [author], 1) -] - -# If true, show URL addresses after external links. -#man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'TwitterAdsAPISDKforPython', u'Twitter Ads API SDK for Python Documentation', - author, 'TwitterAdsAPISDKforPython','A Twitter supported and maintained Ads API SDK for Python.', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -#texinfo_appendices = [] - -# If false, no module index is generated. -#texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/': None} diff --git a/error-hierarchy.png b/error-hierarchy.png deleted file mode 100644 index ec4b562..0000000 Binary files a/error-hierarchy.png and /dev/null differ diff --git a/examples/account_media.py b/examples/account_media.py deleted file mode 100644 index 4f804fc..0000000 --- a/examples/account_media.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) 2015-2016 Twitter, Inc. -# Note: All account_media/media_creatives must be uploaded via the media-upload endpoints -# See: https://dev.twitter.com/rest/media/uploading-media - -from twitter_ads.client import Client -from twitter_ads.http import Request -from twitter_ads.enums import CREATIVE_TYPE -from twitter_ads.creative import AccountMedia, MediaCreative - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'access token' -ACCESS_TOKEN_SECRET = 'access token secret' -ACCOUNT_ID = 'account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# grab the first line_item on the account -line_item_id = account.line_items().first.id - -# retrive the `id` of the media creative associated with a line item -print(account.media_creatives().first.id) - -# retrieve the `id` of the first account media associated with the account -account_media_id = account.account_media().first.id - -# create a new account media -account_media = AccountMedia(account) -account_media.media_id = 'your-media-id' -# OR account_media.video_id OR account_media.vast_url -# see the media_upload.py example for more details -account_media.creative_type = CREATIVE_TYPE.BANNER -account_media.save() - - -#create a new media creative -media_creative = MediaCreative(account) -media_creative.line_item_id = line_item_id -media_creative.account_media_id = account_media_id -media_creative.landing_url = "https://my-landing-url" -media_creative.save() - -# delete the media creative -media_creative.delete() diff --git a/examples/active_entities.py b/examples/active_entities.py deleted file mode 100644 index bdb9fef..0000000 --- a/examples/active_entities.py +++ /dev/null @@ -1,134 +0,0 @@ -from datetime import datetime, timedelta -from dateutil.parser import parse - -from twitter_ads.campaign import LineItem -from twitter_ads.client import Client -from twitter_ads.enum import GRANULARITY, METRIC_GROUP, PLACEMENT -from twitter_ads.utils import remove_hours - - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'access token' -ACCESS_TOKEN_SECRET = 'access token secret' -ACCOUNT_ID = 'account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# analytics request parameters -metric_groups = [METRIC_GROUP.ENGAGEMENT] -granularity = GRANULARITY.HOUR -placement = PLACEMENT.ALL_ON_TWITTER - -# for checking the active entities endpoint for the last day -end_time = datetime.utcnow().date() -start_time = end_time - timedelta(days=1) - -# active entities for line items -active_entities = LineItem.active_entities(account, start_time, end_time) - -# entity IDs to fetch analytics data for -# note: analytics endpoints support a -# maximum of 20 entity IDs per request -ids = [d['entity_id'] for d in active_entities] - -# function for determining the start and end time -# to be used in the subsequent analytics request -# note: if `active_entities` is empty, `date_range` will error -def date_range(data): - """Returns the minimum activity start time and the maximum activity end time - from the active entities response. These dates are modified in the following - way. The hours (and minutes and so on) are removed from the start and end - times and a *day* is added to the end time. These are the dates that should - be used in the subsequent analytics request. - """ - start = min([parse(d['activity_start_time']) for d in data]) - end = max([parse(d['activity_end_time']) for d in data]) - start = remove_hours(start) - end = remove_hours(end) + timedelta(days=1) - return start, end - -# date range for analytics request -start, end = date_range(active_entities) - -# the analytics request for specific line item IDs -# using the derived start and end times -# from the active entities response with -# granularity is set to `HOUR` -LineItem.all_stats(account, ids, metric_groups, granularity=granularity, placement=placement, start_time=start, end_time=end) -""" -[ - { - "id": "du549", - "id_data": [ - { - "metrics": { - "app_clicks": None, - "card_engagements": None, - "carousel_swipes": None, - "clicks": [ - 0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ], - "engagements": [ - 0,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ], - "follows": None, - "impressions": [ - 0,2195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ], - "likes": [ - 0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ], - "poll_card_vote": None, - "qualified_impressions": None, - "replies": None, - "retweets": None, - "tweets_send": None, - "unfollows": None, - "url_clicks": [ - 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ] - }, - "segment": None - } - ] - }, - { - "id": "du5o5", - "id_data": [ - { - "metrics": { - "app_clicks": None, - "card_engagements": None, - "carousel_swipes": None, - "clicks": [ - 0,1,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ], - "engagements": [ - 0,2,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ], - "follows": None, - "impressions": [ - 0,14,538,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ], - "likes": [ - 0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ], - "poll_card_vote": None, - "qualified_impressions": None, - "replies": None, - "retweets": None, - "tweets_send": None, - "unfollows": None, - "url_clicks": None - }, - "segment": None - } - ] - } -] -""" diff --git a/examples/analytics.py b/examples/analytics.py deleted file mode 100644 index a85e95a..0000000 --- a/examples/analytics.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (C) 2015-2016 Twitter, Inc. - -# note: the following is just a simple example. before making any stats calls, make -# sure to read our best practices for analytics which can be found here: -# -# https://dev.twitter.com/ads/analytics/best-practices -# https://dev.twitter.com/ads/analytics/metrics-and-segmentation -# https://dev.twitter.com/ads/analytics/metrics-derived - -import sys -import time - -from twitter_ads.client import Client -from twitter_ads.campaign import LineItem -from twitter_ads.enum import METRIC_GROUP -from twitter_ads.utils import split_list - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'access token' -ACCESS_TOKEN_SECRET = 'access token secret' -ACCOUNT_ID = 'account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# grab the first 10 line items from Cursor -line_items = list(account.line_items(None))[:10] - -# the list of metrics we want to fetch, for a full list of possible metrics -# see: https://dev.twitter.com/ads/analytics/metrics-and-segmentation -metric_groups = [METRIC_GROUP.BILLING] - -# fetching stats on the instance -line_items[0].stats(metric_groups) - -# fetching stats for multiple line items -ids = list(map(lambda x: x.id, line_items)) -if not ids: - print('Error: A minimum of 1 items must be provided for entity_ids') - sys.exit() - -sync_data = [] -# Sync/Async endpoint can handle max 20 entity IDs per request -# so split the ids list into multiple requests -for chunk_ids in split_list(ids, 20): - sync_data.append(LineItem.all_stats(account, chunk_ids, metric_groups)) - -print(sync_data) - -# create async stats jobs and get job ids -queued_job_ids = [] -for chunk_ids in split_list(ids, 20): - queued_job_ids.append(LineItem.queue_async_stats_job(account, chunk_ids, metric_groups).id) - -print(queued_job_ids) - -# let the job complete -seconds = 30 -time.sleep(seconds) - -async_stats_job_results = LineItem.async_stats_job_result(account, job_ids=queued_job_ids) - -async_data = [] -for result in async_stats_job_results: - async_data.append(LineItem.async_stats_job_data(account, url=result.url)) - -print(async_data) diff --git a/examples/audience_estimate.py b/examples/audience_estimate.py deleted file mode 100644 index 110fe4e..0000000 --- a/examples/audience_estimate.py +++ /dev/null @@ -1,40 +0,0 @@ -from twitter_ads.client import Client -from twitter_ads.targeting import AudienceEstimate - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'access token' -ACCESS_TOKEN_SECRET = 'access token secret' -ACCOUNT_ID = 'account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# targeting criteria params -params = { - "targeting_criteria": [ - { - "targeting_type":"LOCATION", - "targeting_value":"96683cc9126741d1" - }, - { - "targeting_type":"BROAD_KEYWORD", - "targeting_value":"cats" - }, - { - "targeting_type":"SIMILAR_TO_FOLLOWERS_OF_USER", - "targeting_value": "14230524" - }, - { - "targeting_type":"SIMILAR_TO_FOLLOWERS_OF_USER", - "targeting_value": "90420314" - } - ] -} - -audience_estimate = AudienceEstimate.load(account=account, params=params) - -print (audience_estimate.audience_size) diff --git a/examples/batch_request.py b/examples/batch_request.py deleted file mode 100644 index 43ebe54..0000000 --- a/examples/batch_request.py +++ /dev/null @@ -1,92 +0,0 @@ -from datetime import datetime - -from twitter_ads.client import Client -from twitter_ads.campaign import Campaign, LineItem, TargetingCriteria -from twitter_ads.enum import ENTITY_STATUS, OBJECTIVE, PLACEMENT, PRODUCT - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'user access token' -ACCESS_TOKEN_SECRET = 'user access token secret' -ADS_ACCOUNT = 'ads account id' - -# initialize the twitter ads api client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load up the account instance -account = client.accounts(ADS_ACCOUNT) - -# create two campaigns -campaign_1 = Campaign(account) -campaign_1.funding_instrument_id = account.funding_instruments().next().id -campaign_1.daily_budget_amount_local_micro = 1000000 -campaign_1.name = 'my first campaign' -campaign_1.entity_status = ENTITY_STATUS.PAUSED -campaign_1.start_time = datetime.utcnow() - -campaign_2 = Campaign(account) -campaign_2.funding_instrument_id = account.funding_instruments().next().id -campaign_2.daily_budget_amount_local_micro = 2000000 -campaign_2.name = 'my second campaign' -campaign_2.entity_status = ENTITY_STATUS.PAUSED -campaign_2.start_time = datetime.utcnow() - -campaigns_list = [campaign_1, campaign_2] -Campaign.batch_save(account, campaigns_list) - -# modify the created campaigns -campaign_1.name = 'my modified first campaign' -campaign_2.name = 'my modified second campaign' - -Campaign.batch_save(account, campaigns_list) - -# create line items for campaign_1 -line_item_1 = LineItem(account) -line_item_1.campaign_id = campaign_1.id -line_item_1.name = 'my first ad' -line_item_1.product_type = PRODUCT.PROMOTED_TWEETS -line_item_1.placements = [PLACEMENT.ALL_ON_TWITTER] -line_item_1.objective = OBJECTIVE.ENGAGEMENTS -line_item_1.bid_amount_local_micro = 10000 -line_item_1.entity_status = ENTITY_STATUS.PAUSED - -line_item_2 = LineItem(account) -line_item_2.campaign_id = campaign_1.id -line_item_2.name = 'my second ad' -line_item_2.product_type = PRODUCT.PROMOTED_TWEETS -line_item_2.placements = [PLACEMENT.ALL_ON_TWITTER] -line_item_2.objective = OBJECTIVE.ENGAGEMENTS -line_item_2.bid_amount_local_micro = 20000 -line_item_2.entity_status = ENTITY_STATUS.PAUSED - -line_items_list = [line_item_1, line_item_2] -LineItem.batch_save(account, line_items_list) - -# create targeting criteria for line_item_1 -targeting_criterion_1 = TargetingCriteria(account) -targeting_criterion_1.line_item_id = line_item_1.id -targeting_criterion_1.targeting_type = 'LOCATION' -targeting_criterion_1.targeting_value = '00a8b25e420adc94' - -targeting_criterion_2 = TargetingCriteria(account) -targeting_criterion_2.line_item_id = line_item_1.id -targeting_criterion_2.targeting_type = 'PHRASE_KEYWORD' -targeting_criterion_2.targeting_value = 'righteous dude' - -targeting_criteria_list = [targeting_criterion_1, targeting_criterion_2] -TargetingCriteria.batch_save(account, targeting_criteria_list) - -targeting_criterion_1.to_delete = True -targeting_criterion_2.to_delete = True - -TargetingCriteria.batch_save(account, targeting_criteria_list) - -line_item_1.to_delete = True -line_item_2.to_delete = True - -LineItem.batch_save(account, line_items_list) - -campaign_1.to_delete = True -campaign_2.to_delete = True - -Campaign.batch_save(account, campaigns_list) diff --git a/examples/batch_tc_from_file.py b/examples/batch_tc_from_file.py deleted file mode 100644 index 77d147d..0000000 --- a/examples/batch_tc_from_file.py +++ /dev/null @@ -1,54 +0,0 @@ -import json - -from twitter_ads.campaign import TargetingCriteria -from twitter_ads.client import Client - -CONSUMER_KEY = "" -CONSUMER_SECRET = "" -ACCESS_TOKEN = "" -ACCESS_TOKEN_SECRET = "" -ADS_ACCOUNT = "" - -# initialize the twitter ads api client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load up the account instance -account = client.accounts(ADS_ACCOUNT) - -# load file -# assumes targeting.json is structured as follows -""" -[ - { - "operation_type":"Create", - "params":{ - "line_item_id":"1a2bc", - "targeting_value":"digital", - "operator_type":"EQ", - "targeting_type":"BROAD_KEYWORD" - } - }, - { - "operation_type":"Create", - "params":{ - "line_item_id":"1a2bc", - "targeting_value":"analog", - "operator_type":"NE", - "targeting_type":"BROAD_KEYWORD" - } - } -] -""" -with open('targeting.json', 'r') as f: - targeting_data = json.load(f) - -targeting = [] -for obj in targeting_data: - tc = TargetingCriteria(account) - tc.line_item_id = obj['params']['line_item_id'] - tc.operator_type = obj['params']['operator_type'] - tc.targeting_type = obj['params']['targeting_type'] - tc.targeting_value = obj['params']['targeting_value'] - targeting.append(tc) - -TargetingCriteria.batch_save(account, targeting) diff --git a/examples/cards.py b/examples/cards.py deleted file mode 100644 index 9b8aeae..0000000 --- a/examples/cards.py +++ /dev/null @@ -1,89 +0,0 @@ -from twitter_ads.client import Client -from twitter_ads.creative import Card -from twitter_ads.http import Request - - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'user access token' -ACCESS_TOKEN_SECRET = 'user access token secret' -ACCOUNT_ID = 'ads account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# fetch all -card = Card.all(account, card_ids="1502039998987587584").first - -# fetch by card-id -card = Card.load(account=account, id="1502039998987587584") - -# edit card destination.url -card.components= [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/newvalue", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ] - -card.save() -print(card.components) - -# create new card -newcard = Card(account=account) -newcard.name="my new card" -components= [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/login", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ] -newcard.components=components -newcard.save() -print(newcard.id) - -# get user_id for as_user_id parameter -user_id = UserIdLookup.load(account, screen_name='your_twitter_handle_name').id - -# create a tweet using this new card -Tweet.create(account, text='Created from the SDK', as_user_id=user_id, card_uri=card.card_uri) -# https://twitter.com/apimctestface/status/1372283476615958529 diff --git a/examples/cards_fetch.py b/examples/cards_fetch.py deleted file mode 100644 index 1645abe..0000000 --- a/examples/cards_fetch.py +++ /dev/null @@ -1,35 +0,0 @@ -from twitter_ads.client import Client -from twitter_ads.creative import CardsFetch -from twitter_ads.http import Request - - -CONSUMER_KEY = '' -CONSUMER_SECRET = '' -ACCESS_TOKEN = '' -ACCESS_TOKEN_SECRET = '' -ACCOUNT_ID = '' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# retrieve a Tweet -tweet_id = '973002610033610753' # use one of your own Tweets -resource = '/1.1/statuses/show/{id}.json'.format(id=tweet_id) -domain = 'https://api.twitter.com' -params = {'include_card_uri' : 'true'} -response = Request(client, 'get', resource, domain=domain, params=params).perform() -card_uri = response.body['card_uri'] # Tweet must include a card_uri card - -# fetch by card_uri -card = CardsFetch.load(account, card_uris=[card_uri]).first -print(card) -print(card.card_type) -print(card.id) - -# fetch by card id -same_card = CardsFetch.load(account, card_id=card.id) -print(same_card.card_type) -print(same_card.card_uri) diff --git a/examples/custom_audience.py b/examples/custom_audience.py deleted file mode 100644 index 1ddaf2e..0000000 --- a/examples/custom_audience.py +++ /dev/null @@ -1,39 +0,0 @@ -import hashlib -from twitter_ads.client import Client -from twitter_ads.audience import CustomAudience - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'access token' -ACCESS_TOKEN_SECRET = 'access token secret' -ACCOUNT_ID = 'account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# create a new custom audience -audience = CustomAudience.create(account, 'test CA') - -# sample user -# all values musth be sha256 hashed -email_hash = hashlib.sha256("test-email@test.com").hexdigest() - -# create payload -user = [{ - "operation_type": "Update", - "params": { - "users": [{ - "email": [ - email_hash - ] - }] - } -}] - -# update the custom audience -success_count, total_count = audience.users(user) -if success_count == total_count: - print(("Successfully added {total_count} users").format(total_count=total_count)) diff --git a/examples/draft_tweet.py b/examples/draft_tweet.py deleted file mode 100644 index 03150be..0000000 --- a/examples/draft_tweet.py +++ /dev/null @@ -1,53 +0,0 @@ -from twitter_ads.client import Client -from twitter_ads.campaign import Tweet -from twitter_ads.creative import DraftTweet -from twitter_ads.restapi import UserIdLookup - - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'user access token' -ACCESS_TOKEN_SECRET = 'user access token secret' -ACCOUNT_ID = 'ads account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# get user_id for as_user_id parameter -user_id = UserIdLookup.load(account, screen_name='your_twitter_handle_name').id - -# fetch draft tweets from a given account -tweets = DraftTweet.all(account) -for tweet in tweets: - print(tweet.id) - print(tweet.text) - -# create a new draft tweet -draft_tweet = DraftTweet(account) -draft_tweet.text = 'draft tweet - new' -draft_tweet.as_user_id = user_id -draft_tweet = draft_tweet.save() -print(draft_tweet.id) -print(draft_tweet.text) - -# fetch single draft tweet metadata -tweet_id = draft_tweet.id -draft_tweet = draft_tweet.load(account, tweet_id) -print(draft_tweet.id) -print(draft_tweet.text) - -# update (PUT) metadata -draft_tweet.text = 'draft tweet - update' -draft_tweet = draft_tweet.save() -print(draft_tweet.id) -print(draft_tweet.text) - -# create a nullcasted tweet using draft tweet metadata -tweet = Tweet.create(account, text=draft_tweet.text, as_user_id=user_id) -print(tweet) - -# delete draft tweet -# draft_tweet.delete() diff --git a/examples/manual_request.py b/examples/manual_request.py deleted file mode 100644 index d11f249..0000000 --- a/examples/manual_request.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (C) 2015 Twitter, Inc. - -from twitter_ads import API_VERSION -from twitter_ads.client import Client -from twitter_ads.cursor import Cursor -from twitter_ads.http import Request -from twitter_ads.error import Error - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'user access token' -ACCESS_TOKEN_SECRET = 'user access token secret' -ADS_ACCOUNT = 'ads account id' - -# initialize the twitter ads api client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load up the account instance -account = client.accounts(ADS_ACCOUNT) - -# using the Request object you can manually request any -# twitter ads api resource that you want. - -resource = '/' + API_VERSION + '/accounts/{account_id}/features'.format(account_id=account.id) -params = {'feature_keys': 'AGE_TARGETING,CPI_CHARGING'} - -# try, build and execute the request with error handling -try: - response = Request(client, 'get', resource, params=params).perform() - print(response.body['data'][0]) -except Error as e: - # see twitter_ads.error for more details - print(e.details) - raise - -# you can also manually construct requests to be -# used in Cursor objects. - -resource = '/' + API_VERSION + '/targeting_criteria/locations' -params = {'location_type': 'CITIES', 'q': 'port'} -request = Request(client, 'get', resource, params=params) -cursor = Cursor(None, request) - -# execute requests and iterate cursor until exhausted -for obj in cursor: - print(obj['name']) diff --git a/examples/media_library.py b/examples/media_library.py deleted file mode 100644 index d6535fb..0000000 --- a/examples/media_library.py +++ /dev/null @@ -1,40 +0,0 @@ -from twitter_ads.client import Client -from twitter_ads.creative import MediaLibrary -from twitter_ads.enum import MEDIA_CATEGORY -from twitter_ads.http import Request - - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'user access token' -ACCESS_TOKEN_SECRET = 'user access token secret' -ACCOUNT_ID = 'ads account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# upload an image to POST media/upload -# https://developer.twitter.com/en/docs/ads/creatives/guides/media-library -resource = '/1.1/media/upload.json' -params = { - 'additional_owners': '756201191646691328', - 'media_category': MEDIA_CATEGORY.TWEET_IMAGE -} -domain = 'https://upload.twitter.com' -files = {'media': (None, open('/path/to/file.jpg', 'rb'))} -response = Request(client, 'post', resource, files=files, domain=domain, params=params).perform() -media_key = response.body['media_key'] - -# add to media library -media_library = MediaLibrary(account) -media_library.name = 'name' -media_library.file_name = 'name.png' -media_library.media_key = media_key -data = media_library.add() - -# update the media -data.name = 'name - updated' -data.update() diff --git a/examples/media_upload.py b/examples/media_upload.py deleted file mode 100644 index 125578d..0000000 --- a/examples/media_upload.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (C) 2015 Twitter, Inc. - -from twitter_ads.client import Client -from twitter_ads.http import Request -from twitter_ads.enum import MEDIA_CATEGORY - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'user access token' -ACCESS_TOKEN_SECRET = 'user access token secret' -ACCOUNT_ID = 'ads account id' - -# initialize the twitter ads api client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# upload an image to POST media/upload -# https://developer.twitter.com/en/docs/ads/creatives/guides/media-library -resource = '/1.1/media/upload.json' -params = { - 'additional_owners': '756201191646691328', - 'media_category': MEDIA_CATEGORY.TWEET_IMAGE -} -domain = 'https://upload.twitter.com' -files = {'media': (None, open('/path/to/file.jpg', 'rb'))} -response = Request(client, 'post', resource, files=files, domain=domain, params=params).perform() - -# extract the media_key value from the response -media_key = response.body['media_key'] diff --git a/examples/poll_card.py b/examples/poll_card.py deleted file mode 100644 index b063d78..0000000 --- a/examples/poll_card.py +++ /dev/null @@ -1,34 +0,0 @@ -from twitter_ads.campaign import Tweet -from twitter_ads.client import Client -from twitter_ads.creative import MediaLibrary, PollCard -from twitter_ads.enum import MEDIA_TYPE - - -CONSUMER_KEY = '' -CONSUMER_SECRET = '' -ACCESS_TOKEN = '' -ACCESS_TOKEN_SECRET = '' -ACCOUNT_ID = '' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# most recent Media Library video -ml = MediaLibrary(account).all(account, media_type=MEDIA_TYPE.VIDEO) -media_key = ml.first.media_key - -# create Poll Card with video -pc = PollCard(account) -pc.duration_in_minutes = 10080 # one week -pc.first_choice = 'Northern' -pc.second_choice = 'Southern' -pc.name = ml.first.name + ' poll card from SDK' -pc.media_key = media_key -pc.save() - -# create Tweet -Tweet.create(account, text='Which hemisphere do you prefer?', card_uri=pc.card_uri) -# https://twitter.com/apimctestface/status/973002610033610753 diff --git a/examples/promoted_tweet.py b/examples/promoted_tweet.py deleted file mode 100644 index adfbe17..0000000 --- a/examples/promoted_tweet.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) 2015 Twitter, Inc. - -from twitter_ads.client import Client -from twitter_ads.campaign import Tweet -from twitter_ads.creative import PromotedTweet, WebsiteCard -from twitter_ads.restapi import UserIdLookup - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'user access token' -ACCESS_TOKEN_SECRET = 'user access token secret' -ACCOUNT_ID = 'ads account id' - -# initialize the twitter ads api client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load up the account instance, campaign and line item -account = client.accounts(ACCOUNT_ID) - -# get user_id for as_user_id parameter -user_id = UserIdLookup.load(account, screen_name='your_twitter_handle_name').id - -campaign = account.campaigns().next() -line_item = account.line_items(None, campaign_ids=campaign.id).next() - -# create request for a simple nullcasted tweet -tweet1 = Tweet.create(account, text='There can be only one...', as_user_id=user_id) - -# create request for a nullcasted tweet with a website card -website_card = WebsiteCard.all(account).next() -tweet2 = Tweet.create( - account, - text='Fine. There can be two.', - as_user_id=user_id, - card_uri=website_card.card_uri) - -# promote the tweet using our line item -tweet_ids = [tweet1['id'], tweet2['id']] - -response = PromotedTweet.attach( - account, - line_item_id=line_item.id, - tweet_ids=tweet_ids -) - -for i in response: - print(i.id) - print(i.tweet_id) diff --git a/examples/quick_start.py b/examples/quick_start.py deleted file mode 100644 index a3614f9..0000000 --- a/examples/quick_start.py +++ /dev/null @@ -1,44 +0,0 @@ -from datetime import datetime - -from twitter_ads.client import Client -from twitter_ads.campaign import Campaign, LineItem, TargetingCriteria -from twitter_ads.enum import ENTITY_STATUS, OBJECTIVE, PLACEMENT, PRODUCT - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'access token' -ACCESS_TOKEN_SECRET = 'access token secret' -ACCOUNT_ID = 'account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# create your campaign -campaign = Campaign(account) -campaign.funding_instrument_id = account.funding_instruments().next().id -campaign.daily_budget_amount_local_micro = 1000000 -campaign.name = 'my first campaign' -campaign.entity_status = ENTITY_STATUS.PAUSED -campaign.start_time = datetime.utcnow() -campaign.save() - -# create a line item for the campaign -line_item = LineItem(account) -line_item.campaign_id = campaign.id -line_item.name = 'my first ad' -line_item.product_type = PRODUCT.PROMOTED_TWEETS -line_item.placements = [PLACEMENT.ALL_ON_TWITTER] -line_item.objective = OBJECTIVE.ENGAGEMENTS -line_item.bid_amount_local_micro = 10000 -line_item.entity_status = ENTITY_STATUS.PAUSED -line_item.save() - -# add targeting criteria -targeting_criteria = TargetingCriteria(account) -targeting_criteria.line_item_id = line_item.id -targeting_criteria.targeting_type = 'LOCATION' -targeting_criteria.targeting_value = '00a8b25e420adc94' -targeting_criteria.save() diff --git a/examples/scheduled_tweet.py b/examples/scheduled_tweet.py deleted file mode 100644 index 67c7236..0000000 --- a/examples/scheduled_tweet.py +++ /dev/null @@ -1,35 +0,0 @@ -from datetime import datetime, timedelta - -from twitter_ads.client import Client -from twitter_ads.campaign import ScheduledPromotedTweet -from twitter_ads.creative import ScheduledTweet -from twitter_ads.restapi import UserIdLookup - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'user access token' -ACCESS_TOKEN_SECRET = 'user access token secret' -ACCOUNT_ID = 'ads account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# get user_id for as_user_id parameter -user_id = UserIdLookup.load(account, screen_name='your_twitter_handle_name').id - -# create the Scheduled Tweet -scheduled_tweet = ScheduledTweet(account) -scheduled_tweet.text = 'Future' -scheduled_tweet.as_user_id = user_id -scheduled_tweet.scheduled_at = datetime.utcnow() + timedelta(days=2) -scheduled_tweet.save() - -# associate with a line item -account.line_items().next().id -scheduled_promoted_tweet = ScheduledPromotedTweet(account) -scheduled_promoted_tweet.line_item_id = line_item_id -scheduled_promoted_tweet.scheduled_tweet_id = scheduled_tweet.id -scheduled_promoted_tweet.save() diff --git a/examples/tailored_audience.py b/examples/tailored_audience.py deleted file mode 100644 index 4723d0b..0000000 --- a/examples/tailored_audience.py +++ /dev/null @@ -1,39 +0,0 @@ -import hashlib -from twitter_ads.client import Client -from twitter_ads.audience import TailoredAudience - -CONSUMER_KEY = 'your consumer key' -CONSUMER_SECRET = 'your consumer secret' -ACCESS_TOKEN = 'access token' -ACCESS_TOKEN_SECRET = 'access token secret' -ACCOUNT_ID = 'account id' - -# initialize the client -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# create a new tailored audience -audience = TailoredAudience.create(account, 'test TA') - -# sample user -# all values musth be sha256 hashed -email_hash = hashlib.sha256("test-email@test.com").hexdigest() - -# create payload -user = [{ - "operation_type": "Update", - "params": { - "users": [{ - "email": [ - email_hash - ] - }] - } -}] - -# update the tailored audience -success_count, total_count = audience.users(user) -if success_count == total_count: - print(("Successfully added {total_count} users").format(total_count=total_count)) diff --git a/examples/tweet_previews.py b/examples/tweet_previews.py deleted file mode 100644 index 5d0dd17..0000000 --- a/examples/tweet_previews.py +++ /dev/null @@ -1,30 +0,0 @@ -from twitter_ads.client import Client -from twitter_ads.creative import TweetPreview -from twitter_ads.enum import TWEET_TYPE - -CONSUMER_KEY = '' -CONSUMER_SECRET = '' -ACCESS_TOKEN = '' -ACCESS_TOKEN_SECRET = '' -ACCOUNT_ID = '' - -# initialize the client -client = Client( - CONSUMER_KEY, - CONSUMER_SECRET, - ACCESS_TOKEN, - ACCESS_TOKEN_SECRET) - -# load the advertiser account instance -account = client.accounts(ACCOUNT_ID) - -# fetch preview data -tweets = TweetPreview.load( - account, - tweet_ids=['1130942781109596160', '1101254234031370240'], - tweet_type=TWEET_TYPE.PUBLISHED) - -# iterate for each tweet -for k in tweets: - print(k.tweet_id) - print(k.preview) diff --git a/examples/video_tutorial.py b/examples/video_tutorial.py deleted file mode 100644 index b11cb5c..0000000 --- a/examples/video_tutorial.py +++ /dev/null @@ -1,114 +0,0 @@ -from twitter_ads.client import Client -from twitter_ads.enum import CREATIVE_TYPE, ENTITY_STATUS, OBJECTIVE, PRODUCT -from twitter_ads.campaign import Campaign, LineItem -from twitter_ads.creative import AccountMedia, Video -from twitter_ads import API_VERSION - -from datetime import datetime - -from twython import Twython, TwythonError - -# auth -twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) - -# the video to be uploaded -video = open('/path/to/sample-video.mp4', 'rb') - -upload_video = twitter.upload_video(media=video, media_type='video/mp4', media_category='amplify_video', check_progress=True) - -#grab the media_id from the response -media_id = upload_video['media_id'] - -client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) - -account = client.accounts(ADS_ACCOUNT) - -video = Video(account) -video.video_media_id = media_id # from previous step -video.description = "My sample videos" -video.title = "Video tutorial test" -video.save() - -#grab the video_id from the response -video_id = video.id -print(video_id) - -account_media = AccountMedia(account) -account_media.video_id = video_id -account_media.creative_type = CREATIVE_TYPE.PREROLL -account_media.save() - -# create a campaign -campaign = Campaign(account) -campaign.name="Video tutorial test" -# get the first funding instrument on the account -campaign.funding_instrument_id = account.funding_instruments().first.id -campaign.daily_budget_amount_local_micro = 1000000000 -campaign.entity_status = ENTITY_STATUS.PAUSED -campaign.start_time = datetime.utcnow() -campaign.save() - -# create a line item with the PREROLL_VIEWS -# objective and product_type MEDIA -line_item = LineItem(account) -line_item.objective = OBJECTIVE.PREROLL_VIEWS - -line_item.campaign_id = campaign.id -line_item.name = 'Video tutorial example' -line_item.product_type = 'MEDIA' -line_item.placements = [PLACEMENT.ALL_ON_TWITTER] -line_item.bid_amount_local_micro = 1000000 -line_item.entity_status = ENTITY_STATUS.PAUSED -line_item.categories = 'IAB1' -line_item.save() - -from twitter_ads.http import Request - -resource = '/' + API_VERSION + '/accounts/18ce54bgxky/preroll_call_to_actions'.format(account_id=account.id) -params = { - 'line_item_id' : line_item.id, - 'call_to_action' : 'WATCH_NOW', - 'call_to_action_url' : 'https://www.my-cta-url.com' -} - -# try, build and execute the request with error handling -try: - response = Request(client, 'post', resource, params=params).perform() -except Error as e: - # see twitter_ads.error for more details - print(e.details) - raise - -resource = '/' + API_VERSION + '/batch/accounts/18ce54bgxky/targeting_criteria'.format(account_id=account.id) - -params = [ - { - "operation_type": "Create", - "params": { - "line_item_id": line_item.id, - "targeting_type": "CONTENT_PUBLISHER_USER", - "targeting_value": "312226591", - "negated": true - } - }, - { - "operation_type": "Create", - "params": { - "line_item_id": line_item.id, - "targeting_type": "IAB_CATEGORY", - "targeting_value": "IAB2", - "negated": true - } - } -] - -try: - response = Request(client, 'post', resource, params=params).perform() -except Error as e: - # see twitter_ads.error for more details - print(e.details) - raise - -# unpause the campaign -campaign.entity_status = ENTITY_STATUS.ACTIVE -campaign.save() diff --git a/index.html b/index.html new file mode 100644 index 0000000..d741c47 --- /dev/null +++ b/index.html @@ -0,0 +1,155 @@ + + + + + + Twitter Ads API SDK for Python + + + + + + + +
+
+

Twitter Ads SDK
for Python

+ A Twitter supported and maintained Ads API SDK for Python. +

+

+ Examples & Guides
+ Twitter Ads SDK Documentation
+ Twitter Ads API Documentation
+ Twitter Community (Ads API)
+

+ +
+
+

+ Build Status Code Climate PyPy Version

+ +

+Installation

+ +
# installing the latest signed release
+pip install twitter-ads
+
+ +

+Quick Start

+ +
from twitter_ads.client import Client
+from twitter_ads.client import Client
+from twitter_ads.campaign import Campaign
+from twitter_ads.enum import ENTITY_STATUS
+
+CONSUMER_KEY = 'your consumer key'
+CONSUMER_SECRET = 'your consumer secret'
+ACCESS_TOKEN = 'access token'
+ACCESS_TOKEN_SECRET = 'access token secret'
+ACCOUNT_ID = 'account id'
+
+# initialize the client
+client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
+
+# load the advertiser account instance
+account = client.accounts(ACCOUNT_ID)
+
+# load and update a specific campaign
+campaign = account.campaigns().next()
+campaign.name = 'updated campaign name'
+campaign.entity_status = ENTITY_STATUS.PAUSED
+campaign.save()
+
+# iterate through campaigns
+for campaign in account.campaigns():
+    print(campaign.id)
+
+ +

+Command Line Helper

+ +
# The twitter-ads command launches an interactive session for testing purposes
+# with a client instance automatically loaded from your .twurlrc file.
+
+~ ❯ twitter-ads
+
+ +

For more help please see our Examples and Guides or check the online Reference Documentation.

+ +

+Compatibility & Versioning

+ +

This project is designed to work with Python 2.7 or greater. While it may work on other version of Python, below are the platform and runtime versions we officially support and regularly test against.

+ + + + + + + + + + + + + + + + + + + + + + +
PlatformVersions
CPython2.7, 3.5, 3.6, 3.7
PyPy7.x
+ +

All releases adhere to strict semantic versioning. For Example, major.minor.patch-pre (aka. stick.carrot.oops-peek).

+ +

+Development

+ +

If you’d like to contribute to the project or try an unreleased development version of this project locally, you can do so quite easily by following the examples below.

+ +
# clone the repository
+git clone git@github.com:twitterdev/twitter-python-ads-sdk.git
+cd twitter-python-ads-sdk
+
+# install dependencies
+pip install -r requirements.txt
+
+# installing a local unsigned release
+pip install -e .
+
+ +

We love community contributions! If you’re planning to send us a pull request, please make sure read our Contributing Guidelines first.

+ +

+Feedback and Bug Reports

+ +

Found an issue? Please open up a GitHub issue or even better yet send us a pull request. Have a question? Want to discuss a new feature? Come chat with us in the Twitter Community Forums.

+ +

+License

+ +

The MIT License (MIT)

+ +

Copyright (C) 2019 Twitter, Inc.

+ +

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

+ +

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

+ +

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+
+
+ + + diff --git a/javascripts/scale.fix.js b/javascripts/scale.fix.js new file mode 100644 index 0000000..87a40ca --- /dev/null +++ b/javascripts/scale.fix.js @@ -0,0 +1,17 @@ +var metas = document.getElementsByTagName('meta'); +var i; +if (navigator.userAgent.match(/iPhone/i)) { + for (i=0; i\r\n\r\n\r\n\r\n\r\n\r\n\r\nPlatform\r\nVersions\r\n\r\n\r\n\r\n\r\nCPython\r\n2.7, 3.2, 3.3, 3.4\r\n\r\n\r\nPyPy\r\n2.x, 4.x\r\n\r\n\r\n\r\n\r\nAll releases adhere to strict [semantic versioning](http://semver.org). For Example, major.minor.patch-pre (aka. stick.carrot.oops-peek).\r\n\r\nDevelopment\r\n===========\r\n\r\nIf you’d like to contribute to the project or try an unreleased development version of this project locally, you can do so quite easily by following the examples below.\r\n\r\n``` sourceCode\r\n# clone the repository\r\ngit clone git@github.com:twitterdev/twitter-python-ads-sdk.git\r\ncd twitter-python-ads-sdk\r\n\r\n# install dependencies\r\npip install -r requirements.txt\r\n\r\n# installing a local unsigned release\r\npip install -e .\r\n```\r\n\r\nWe love community contributions! If you’re planning to send us a pull request, please make sure read our [Contributing Guidelines](https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/CONTRIBUTING.md) first.\r\n\r\nFeedback and Bug Reports\r\n========================\r\n\r\nFound an issue? Please open up a [GitHub issue](https://github.com/twitterdev/twitter-python-ads-sdk/issues) or even better yet [send us](https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/CONTRIBUTING.md) a pull request. Have a question? Want to discuss a new feature? Come chat with us in the [Twitter Community Forums](https://twittercommunity.com/c/advertiser-api).\r\n\r\nLicense\r\n=======\r\n\r\nThe MIT License (MIT)\r\n\r\nCopyright (C) 2015 Twitter, Inc.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file diff --git a/python-sdk.png b/python-sdk.png new file mode 100644 index 0000000..b4364b9 Binary files /dev/null and b/python-sdk.png differ diff --git a/reference/.gitkeep b/reference/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/reference/_modules/account.html b/reference/_modules/account.html new file mode 100644 index 0000000..b5269a0 --- /dev/null +++ b/reference/_modules/account.html @@ -0,0 +1,300 @@ + + + + + + + account — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for account

+# Copyright (C) 2015 Twitter, Inc.
+
+"""
+A Twitter supported and maintained Ads API SDK for Python.
+"""
+from twitter_ads.enum import TRANSFORM
+from twitter_ads.http import Request
+from twitter_ads.cursor import Cursor
+from twitter_ads.utils import Deprecated
+from twitter_ads import API_VERSION
+
+from twitter_ads.resource import resource_property, Resource
+from twitter_ads.creative import (AccountMedia, MediaCreative, ScheduledTweet,
+                                  VideoWebsiteCard, PromotedTweet)
+from twitter_ads.audience import TailoredAudience
+from twitter_ads.campaign import (AppList, Campaign, FundingInstrument, LineItem,
+                                  PromotableUser, ScheduledPromotedTweet)
+
+
+
[docs]class Account(Resource): + """ + The Ads API :class:`Account` class which functions as a context container + for the advertiser and nearly all interactions with the API. + """ + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts' + RESOURCE = '/' + API_VERSION + '/accounts/{id}' + FEATURES = '/' + API_VERSION + '/accounts/{id}/features' + SCOPED_TIMELINE = '/5/accounts/{id}/scoped_timeline' + + def __init__(self, client): + self._client = client + + @property + def client(self): + return self._client + + @property + def account(self): + return NotImplementedError + +
[docs] @classmethod + def load(klass, client, id, **kwargs): + """Returns an object instance for a given resource.""" + resource = klass.RESOURCE.format(id=id) + response = Request(client, 'get', resource, params=kwargs).perform() + return klass(client).from_response(response.body['data'])
+ +
[docs] @classmethod + def all(klass, client, **kwargs): + """Returns a Cursor instance for a given resource.""" + resource = klass.RESOURCE_COLLECTION + request = Request(client, 'get', resource, params=kwargs) + return Cursor(klass, request, init_with=[client])
+ +
[docs] def reload(self, **kwargs): + """ + Reloads all attributes for the current object instance from the API. + """ + if not self.id: + return self + + params = {'with_deleted': True} + params.update(kwargs) + + resource = self.RESOURCE.format(account_id=self.account.id, id=self.id) + response = Request(self.account.client, 'get', resource, params=params).perform() + + self.from_response(response.body['data'])
+ +
[docs] def features(self): + """ + Returns a collection of features available to the current account. + """ + self._validate_loaded() + + resource = self.FEATURES.format(id=self.id) + response = Request(self.client, 'get', resource).perform() + + return response.body['data']
+ +
[docs] def promotable_users(self, id=None, **kwargs): + """ + Returns a collection of promotable users available to the + current account. + """ + return self._load_resource(PromotableUser, id, **kwargs)
+ +
[docs] def funding_instruments(self, id=None, **kwargs): + """ + Returns a collection of funding instruments available to + the current account. + """ + return self._load_resource(FundingInstrument, id, **kwargs)
+ +
[docs] def campaigns(self, id=None, **kwargs): + """ + Returns a collection of campaigns available to the current account. + """ + return self._load_resource(Campaign, id, **kwargs)
+ +
[docs] def line_items(self, id=None, **kwargs): + """ + Returns a collection of line items available to the current account. + """ + return self._load_resource(LineItem, id, **kwargs)
+ +
[docs] def app_lists(self, id=None, **kwargs): + """ + Returns a collection of app lists available to the current account. + """ + return self._load_resource(AppList, id, **kwargs)
+ +
[docs] def tailored_audiences(self, id=None, **kwargs): + """ + Returns a collection of tailored audiences available to the + current account. + """ + return self._load_resource(TailoredAudience, id, **kwargs)
+ +
[docs] def account_media(self, id=None, **kwargs): + """ + Returns a collection of account media available to the current account. + """ + return self._load_resource(AccountMedia, id, **kwargs)
+ +
[docs] def media_creatives(self, id=None, **kwargs): + """ + Returns a collection of media creatives available to the current account. + """ + return self._load_resource(MediaCreative, id, **kwargs)
+ +
[docs] def scheduled_tweets(self, id=None, **kwargs): + """ + Returns a collection of Scheduled Tweets available to the current account. + """ + return self._load_resource(ScheduledTweet, id, **kwargs)
+ +
[docs] def promoted_tweets(self, id=None, **kwargs): + """ + Returns a collection of promoted tweets available to the current account. + """ + return self._load_resource(PromotedTweet, id, **kwargs)
+ +
[docs] def scheduled_promoted_tweets(self, id=None, **kwargs): + """ + Returns a collection of Scheduled Promoted Tweets available to the current account. + """ + return self._load_resource(ScheduledPromotedTweet, id, **kwargs)
+ +
[docs] def video_website_cards(self, id=None, **kwargs): + """ + Returns a collection of video website cards available to the current account. + """ + return self._load_resource(VideoWebsiteCard, id, **kwargs)
+ + @Deprecated('This method has been deprecated as of version 5' + 'and no longer works in the latest version.') + def scoped_timeline(self, *id, **kwargs): + """ + Returns the most recent promotable Tweets created by the specified Twitter user. + """ + self._validate_loaded() + + params = {'user_id': id} + params.update(kwargs) + + resource = self.SCOPED_TIMELINE.format(id=self.id) + response = Request(self.client, 'get', resource, params=params).perform() + + return response.body['data']
+ + +# account properties +resource_property(Account, 'id', readonly=True) +resource_property(Account, 'name', readonly=True) +resource_property(Account, 'salt', readonly=True) +resource_property(Account, 'timezone', readonly=True) +resource_property(Account, 'approval_status', readonly=True) +resource_property(Account, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(Account, 'timezone_switch_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(Account, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(Account, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(Account, 'account_name') +resource_property(Account, 'industry_type') +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/audience.html b/reference/_modules/audience.html new file mode 100644 index 0000000..ff88699 --- /dev/null +++ b/reference/_modules/audience.html @@ -0,0 +1,263 @@ + + + + + + + audience — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for audience

+# Copyright (C) 2015 Twitter, Inc.
+
+"""Container for all audience management logic used by the Ads API SDK."""
+
+from twitter_ads.enum import TRANSFORM
+from twitter_ads.resource import resource_property, Resource
+from twitter_ads.http import Request
+from twitter_ads.error import BadRequest
+from twitter_ads.cursor import Cursor
+from twitter_ads import API_VERSION
+
+import json
+
+
+
[docs]class TailoredAudience(Resource): + + PROPERTIES = {} + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/tailored_audiences' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/tailored_audiences/{id}' + RESOURCE_USERS = '/' + API_VERSION + '/accounts/{account_id}/tailored_audiences/\ +{id}/users' + RESOURCE_PERMISSIONS = '/' + API_VERSION + '/accounts/{account_id}/tailored_audiences/\ +{id}/permissions' + +
[docs] @classmethod + def create(klass, account, name): + """ + Creates a new tailored audience. + """ + audience = klass(account) + getattr(audience, '__create_audience__')(name) + try: + return audience.reload() + except BadRequest as e: + audience.delete() + raise e
+ +
[docs] def users(self, params): + """ + This is a private API and requires whitelisting from Twitter. + This endpoint will allow partners to add, update and remove users from a given + tailored_audience_id. + The endpoint will also accept multiple user identifier types per user as well. + """ + resource = self.RESOURCE_USERS.format(account_id=self.account.id, id=self.id) + headers = {'Content-Type': 'application/json'} + response = Request(self.account.client, + 'post', + resource, + headers=headers, + body=json.dumps(params)).perform() + success_count = response.body['data']['success_count'] + total_count = response.body['data']['total_count'] + return (success_count, total_count)
+ +
[docs] def delete(self): + """ + Deletes the current tailored audience instance. + """ + resource = self.RESOURCE.format(account_id=self.account.id, id=self.id) + response = Request(self.account.client, 'delete', resource).perform() + return self.from_response(response.body['data'])
+ +
[docs] def permissions(self, **kwargs): + """ + Returns a collection of permissions for the curent tailored audience. + """ + self._validate_loaded() + return TailoredAudiencePermission.all(self.account, self.id, **kwargs)
+ + def __create_audience__(self, name): + params = {'name': name} + resource = self.RESOURCE_COLLECTION.format(account_id=self.account.id) + response = Request(self.account.client, 'post', resource, params=params).perform() + return self.from_response(response.body['data'])
+ + +# tailored audience properties +# read-only +resource_property(TailoredAudience, 'id', readonly=True) +resource_property(TailoredAudience, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(TailoredAudience, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(TailoredAudience, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(TailoredAudience, 'audience_size', readonly=True) +resource_property(TailoredAudience, 'audience_type', readonly=True) +resource_property(TailoredAudience, 'metadata', readonly=True) +resource_property(TailoredAudience, 'partner_source', readonly=True) +resource_property(TailoredAudience, 'reasons_not_targetable', readonly=True) +resource_property(TailoredAudience, 'targetable', readonly=True) +resource_property(TailoredAudience, 'targetable_types', readonly=True) +# writable +resource_property(TailoredAudience, 'name') +resource_property(TailoredAudience, 'list_type') + + +
[docs]class TailoredAudiencePermission(Resource): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/tailored_audiences/' + RESOURCE_COLLECTION += '{tailored_audience_id}/permissions' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/tailored_audiences/\ +{tailored_audience_id}/permissions/{id}' + +
[docs] @classmethod + def all(klass, account, tailored_audience_id, **kwargs): + """Returns a Cursor instance for the given tailored audience permission resource.""" + + resource = klass.RESOURCE_COLLECTION.format( + account_id=account.id, + tailored_audience_id=tailored_audience_id) + request = Request(account.client, 'get', resource, params=kwargs) + + return Cursor(klass, request, init_with=[account])
+ +
[docs] def save(self): + """ + Saves or updates the current tailored audience permission. + """ + resource = self.RESOURCE_COLLECTION.format( + account_id=self.account.id, + tailored_audience_id=self.tailored_audience_id) + + response = Request( + self.account.client, 'post', + resource, params=self.to_params()).perform() + + return self.from_response(response.body['data'])
+ +
[docs] def delete(self): + """ + Deletes the current tailored audience permission. + """ + resource = self.RESOURCE.format( + account_id=self.account.id, + tailored_audience_id=self.tailored_audience_id, + id=self.id) + response = Request(self.account.client, 'delete', resource).perform() + return self.from_response(response.body['data'])
+ + +# tailored audience permission properties +# read-only +resource_property(TailoredAudiencePermission, 'id', readonly=True) +resource_property(TailoredAudiencePermission, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(TailoredAudiencePermission, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(TailoredAudiencePermission, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +# writable +resource_property(TailoredAudiencePermission, 'tailored_audience_id') +resource_property(TailoredAudiencePermission, 'granted_account_id') +resource_property(TailoredAudiencePermission, 'permission_level') +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/campaign.html b/reference/_modules/campaign.html new file mode 100644 index 0000000..8d43f83 --- /dev/null +++ b/reference/_modules/campaign.html @@ -0,0 +1,529 @@ + + + + + + + campaign — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for campaign

+# Copyright (C) 2015 Twitter, Inc.
+
+"""Container for all campaign management logic used by the Ads API SDK."""
+
+from twitter_ads.enum import TRANSFORM
+from twitter_ads.resource import resource_property, Resource, Persistence, Batch, Analytics
+from twitter_ads.http import Request
+from twitter_ads.cursor import Cursor
+from twitter_ads.utils import FlattenParams
+from twitter_ads import API_VERSION
+
+
+
[docs]class TargetingCriteria(Resource, Persistence, Batch): + + PROPERTIES = {} + + BATCH_RESOURCE_COLLECTION = '/' + API_VERSION + '/batch/accounts/{account_id}/\ +targeting_criteria' + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/targeting_criteria' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/targeting_criteria/{id}' + RESOURCE_OPTIONS = '/' + API_VERSION + '/targeting_criteria/' + + @classmethod + @FlattenParams + def all(klass, account, **kwargs): + """Returns a Cursor instance for a given resource.""" + resource = klass.RESOURCE_COLLECTION.format(account_id=account.id) + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(klass, request, init_with=[account]) + +
[docs] @classmethod + def app_store_categories(klass, account, **kwargs): + """Returns a list of supported app store categories""" + resource = klass.RESOURCE_OPTIONS + 'app_store_categories' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def behavior_taxonomies(klass, account, **kwargs): + """Returns a list of supported behavior taxonomies""" + resource = klass.RESOURCE_OPTIONS + 'behavior_taxonomies' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def behaviors(klass, account, **kwargs): + """Returns a list of supported behaviors""" + resource = klass.RESOURCE_OPTIONS + 'behaviors' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def conversations(klass, account, **kwargs): + """Returns a list of supported conversations""" + resource = klass.RESOURCE_OPTIONS + 'conversations' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def devices(klass, account, **kwargs): + """Returns a list of supported devices""" + resource = klass.RESOURCE_OPTIONS + 'devices' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def events(klass, account, **kwargs): + """Returns a list of supported events""" + resource = klass.RESOURCE_OPTIONS + 'events' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def interests(klass, account, **kwargs): + """Returns a list of supported interests""" + resource = klass.RESOURCE_OPTIONS + 'interests' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def languages(klass, account, **kwargs): + """Returns a list of supported languages""" + resource = klass.RESOURCE_OPTIONS + 'languages' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def locations(klass, account, **kwargs): + """Returns a list of supported locations""" + resource = klass.RESOURCE_OPTIONS + 'locations' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def network_operators(klass, account, **kwargs): + """Returns a list of supported network operators""" + resource = klass.RESOURCE_OPTIONS + 'network_operators' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def platforms(klass, account, **kwargs): + """Returns a list of supported platforms""" + resource = klass.RESOURCE_OPTIONS + 'platforms' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def platform_versions(klass, account, **kwargs): + """Returns a list of supported platform versions""" + resource = klass.RESOURCE_OPTIONS + 'platform_versions' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def tv_markets(klass, account, **kwargs): + """Returns a list of supported TV markets""" + resource = klass.RESOURCE_OPTIONS + 'tv_markets' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ +
[docs] @classmethod + def tv_shows(klass, account, **kwargs): + """Returns a list of supported TV shows""" + resource = klass.RESOURCE_OPTIONS + 'tv_shows' + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(None, request)
+ + +# targeting criteria properties +# read-only +resource_property(TargetingCriteria, 'id', readonly=True) +resource_property(TargetingCriteria, 'name', readonly=True) +resource_property(TargetingCriteria, 'localized_name', readonly=True) +resource_property(TargetingCriteria, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(TargetingCriteria, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(TargetingCriteria, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +# writable +resource_property(TargetingCriteria, 'line_item_id') +resource_property(TargetingCriteria, 'operator_type') +resource_property(TargetingCriteria, 'targeting_type') +resource_property(TargetingCriteria, 'targeting_value') +resource_property(TargetingCriteria, 'tailored_audience_expansion') +# sdk-only +resource_property(TargetingCriteria, 'to_delete', transform=TRANSFORM.BOOL) + + +
[docs]class FundingInstrument(Analytics, Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/funding_instruments' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/funding_instruments/{id}'
+ + +# funding instrument properties +# read-only +resource_property(FundingInstrument, 'id', readonly=True) +resource_property(FundingInstrument, 'name', readonly=True) +resource_property(FundingInstrument, 'credit_limit_local_micro', readonly=True) +resource_property(FundingInstrument, 'currency', readonly=True) +resource_property(FundingInstrument, 'description', readonly=True) +resource_property(FundingInstrument, 'funded_amount_local_micro', readonly=True) +resource_property(FundingInstrument, 'type', readonly=True) +resource_property(FundingInstrument, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(FundingInstrument, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(FundingInstrument, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(FundingInstrument, 'able_to_fund', readonly=True, transform=TRANSFORM.BOOL) +resource_property(FundingInstrument, 'entity_status', readonly=True) +resource_property(FundingInstrument, 'io_header', readonly=True) +resource_property(FundingInstrument, 'reasons_not_able_to_fund', readonly=True, + transform=TRANSFORM.LIST) +resource_property(FundingInstrument, 'start_time', readonly=True) +resource_property(FundingInstrument, 'end_time', readonly=True) +resource_property(FundingInstrument, 'credit_remaining_local_micro', readonly=True) + + +
[docs]class PromotableUser(Resource): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/promotable_users' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/promotable_users/{id}'
+ + +# promotable user properties +# read-only +resource_property(PromotableUser, 'id', readonly=True) +resource_property(PromotableUser, 'promotable_user_type', readonly=True) +resource_property(PromotableUser, 'user_id', readonly=True) +resource_property(PromotableUser, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(PromotableUser, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(PromotableUser, 'deleted', readonly=True, transform=TRANSFORM.BOOL) + + +
[docs]class AppList(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/app_lists' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/app_lists/{id}' + + @classmethod + @FlattenParams + def create(klass, account, **kwargs): + resource = klass.RESOURCE_COLLECTION.format(account_id=account.id) + response = Request(account.client, 'post', resource, params=kwargs).perform() + return klass(account).from_response(response.body['data']) + + def apps(self): + if self.id and not hasattr(self, '_apps'): + self.reload() + return self._apps
+ + +# app list properties +# read-only +resource_property(AppList, 'id', readonly=True) +resource_property(AppList, 'name', readonly=True) +resource_property(AppList, 'apps', readonly=True) + + +
[docs]class Campaign(Analytics, Resource, Persistence, Batch): + + PROPERTIES = {} + + BATCH_RESOURCE_COLLECTION = '/' + API_VERSION + '/batch/accounts/{account_id}/campaigns' + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/campaigns' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/campaigns/{id}'
+ + +# campaign properties +# read-only +resource_property(Campaign, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(Campaign, 'currency', readonly=True) +resource_property(Campaign, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(Campaign, 'id', readonly=True) +resource_property(Campaign, 'reasons_not_servable', readonly=True) +resource_property(Campaign, 'servable', readonly=True, transform=TRANSFORM.BOOL) +resource_property(Campaign, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(Campaign, 'daily_budget_amount_local_micro') +resource_property(Campaign, 'duration_in_days', transform=TRANSFORM.INT) +resource_property(Campaign, 'end_time', transform=TRANSFORM.TIME) +resource_property(Campaign, 'entity_status') +resource_property(Campaign, 'frequency_cap', transform=TRANSFORM.INT) +resource_property(Campaign, 'funding_instrument_id') +resource_property(Campaign, 'name') +resource_property(Campaign, 'standard_delivery', transform=TRANSFORM.BOOL) +resource_property(Campaign, 'start_time', transform=TRANSFORM.TIME) +resource_property(Campaign, 'total_budget_amount_local_micro') +# sdk-only +resource_property(Campaign, 'to_delete', transform=TRANSFORM.BOOL) + + +
[docs]class LineItem(Analytics, Resource, Persistence, Batch): + + PROPERTIES = {} + + BATCH_RESOURCE_COLLECTION = '/' + API_VERSION + '/batch/accounts/{account_id}/line_items' + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/line_items' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/line_items/{id}' + +
[docs] def targeting_criteria(self, id=None, **kwargs): + """ + Returns a collection of targeting criteria available to the + current line item. + """ + self._validate_loaded() + if id is None: + return TargetingCriteria.all(self.account, line_item_ids=[self.id], **kwargs) + else: + return TargetingCriteria.load(self.account, id, **kwargs)
+ + +# line item properties +# read-only +resource_property(LineItem, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(LineItem, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(LineItem, 'id', readonly=True) +resource_property(LineItem, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(LineItem, 'advertiser_domain') +resource_property(LineItem, 'advertiser_user_id') +resource_property(LineItem, 'automatically_select_bid', transform=TRANSFORM.BOOL) +resource_property(LineItem, 'bid_amount_local_micro') +resource_property(LineItem, 'bid_type') +resource_property(LineItem, 'bid_unit') +resource_property(LineItem, 'campaign_id') +resource_property(LineItem, 'categories', transform=TRANSFORM.LIST) +resource_property(LineItem, 'charge_by') +resource_property(LineItem, 'end_time', transform=TRANSFORM.TIME) +resource_property(LineItem, 'entity_status') +resource_property(LineItem, 'include_sentiment') +resource_property(LineItem, 'audience_expansion') +resource_property(LineItem, 'name') +resource_property(LineItem, 'objective') +resource_property(LineItem, 'optimization') +resource_property(LineItem, 'placements', transform=TRANSFORM.LIST) +resource_property(LineItem, 'primary_web_event_tag') +resource_property(LineItem, 'product_type') +resource_property(LineItem, 'start_time', transform=TRANSFORM.TIME) +resource_property(LineItem, 'total_budget_amount_local_micro') +resource_property(LineItem, 'tracking_tags') +# sdk-only +resource_property(LineItem, 'to_delete', transform=TRANSFORM.BOOL) + + +
[docs]class ScheduledPromotedTweet(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/scheduled_promoted_tweets' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/scheduled_promoted_tweets/{id}'
+ + +# scheduled promoted tweets properties +# read-only +resource_property(ScheduledPromotedTweet, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(ScheduledPromotedTweet, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(ScheduledPromotedTweet, 'id', readonly=True) +resource_property(ScheduledPromotedTweet, 'tweet_id', readonly=True) +resource_property(ScheduledPromotedTweet, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(ScheduledPromotedTweet, 'line_item_id') +resource_property(ScheduledPromotedTweet, 'scheduled_tweet_id') + + +class Tweet(object): + + TWEET_CREATE = '/' + API_VERSION + '/accounts/{account_id}/tweet' + + def __init__(self): + raise NotImplementedError( + 'Error! {name} cannot be instantiated.'.format(name=self.__class__.__name__)) + + @classmethod + @FlattenParams + def create(klass, account, **kwargs): + """ + Creates a "Promoted-Only" Tweet using the specialized Ads API end point. + """ + resource = klass.TWEET_CREATE.format(account_id=account.id) + response = Request(account.client, 'post', resource, params=kwargs).perform() + return response.body['data'] + + +
[docs]class UserSettings(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/user_settings/{id}'
+ + +# user settings properties +# writable +resource_property(UserSettings, 'notification_email') +resource_property(UserSettings, 'contact_phone') +resource_property(UserSettings, 'contact_phone_extension') +resource_property(UserSettings, 'subscribed_email_types') +resource_property(UserSettings, 'user_id') + + +
[docs]class TaxSettings(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/tax_settings' + +
[docs] @classmethod + def load(self, account): + """ + Returns an object instance for a given account. + """ + resource = self.RESOURCE.format(account_id=account.id) + response = Request(account.client, 'get', resource).perform() + return self(account).from_response(response.body['data'])
+ +
[docs] def save(self): + """ + Update the current object instance. + """ + resource = self.RESOURCE.format(account_id=self.account.id) + response = Request( + self.account.client, 'put', + resource, params=self.to_params()).perform() + return self.from_response(response.body['data'])
+ + +# tax settings properties +# writable +resource_property(TaxSettings, 'address_city') +resource_property(TaxSettings, 'address_country') +resource_property(TaxSettings, 'address_email') +resource_property(TaxSettings, 'address_first_name') +resource_property(TaxSettings, 'address_last_name') +resource_property(TaxSettings, 'address_name') +resource_property(TaxSettings, 'address_postal_code') +resource_property(TaxSettings, 'address_region') +resource_property(TaxSettings, 'address_street1') +resource_property(TaxSettings, 'address_street2') +resource_property(TaxSettings, 'bill_to') +resource_property(TaxSettings, 'business_relationship') +resource_property(TaxSettings, 'client_address_city') +resource_property(TaxSettings, 'client_address_country') +resource_property(TaxSettings, 'client_address_email') +resource_property(TaxSettings, 'client_address_first_name') +resource_property(TaxSettings, 'client_address_last_name') +resource_property(TaxSettings, 'client_address_name') +resource_property(TaxSettings, 'client_address_postal_code') +resource_property(TaxSettings, 'client_address_region') +resource_property(TaxSettings, 'client_address_street1') +resource_property(TaxSettings, 'client_address_street2') +resource_property(TaxSettings, 'invoice_jurisdiction') +resource_property(TaxSettings, 'tax_category') +resource_property(TaxSettings, 'tax_exemption_id') +resource_property(TaxSettings, 'tax_id') +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/client.html b/reference/_modules/client.html new file mode 100644 index 0000000..fec4c9b --- /dev/null +++ b/reference/_modules/client.html @@ -0,0 +1,206 @@ + + + + + + + client — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for client

+# Copyright (C) 2015 Twitter, Inc.
+
+"""
+A Twitter supported and maintained Ads API SDK for Python.
+"""
+
+from twitter_ads.account import Account
+
+
+
[docs]class Client(object): + """ + The Ads API Client class which functions as a container for basic + API consumer information. + """ + + def __init__(self, + consumer_key, + consumer_secret, + access_token, + access_token_secret, + **kwargs): + """ + Creates a new Ads API client instance. + + ..seealso:: :doc:`/examples/quick_start.py` + """ + self._consumer_key = consumer_key + self._consumer_secret = consumer_secret + self._access_token = access_token + self._access_token_secret = access_token_secret + self._options = kwargs.get('options', {}) + + def __repr__(self): + return '<{name} object at {mem} consumer_key={key}>'.format( + name=self.__class__.__name__, + mem=hex(id(self)), + key=getattr(self, 'consumer_key') + ) + + @property + def options(self): + """Returns the options value.""" + return self._options + + @property + def consumer_key(self): + """Returns the consumer_key value.""" + return self._consumer_key + + @property + def consumer_secret(self): + """Returns the consumer_secret value.""" + return self._consumer_secret + + @property + def access_token(self): + """Returns the access_token value.""" + return self._access_token + + @property + def access_token_secret(self): + """Returns the access_token_secret value.""" + return self._access_token_secret + + def sandbox(): + """Enables and disables sandbox mode.""" + def fget(self): + return self._options.get('sandbox', None) + + def fset(self, value): + self._options['sandbox'] = value + + return locals() + + sandbox = property(**sandbox()) + + def trace(): + """Enables and disables request tracing.""" + def fget(self): + return self._options.get('trace', None) + + def fset(self, value): + self._options['trace'] = value + + return locals() + + trace = property(**trace()) + +
[docs] def accounts(self, id=None): + """ + Returns a collection of advertiser :class:`Accounts` available to + the current access token. + """ + return Account.load(self, id) if id else Account.all(self)
+
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/creative.html b/reference/_modules/creative.html new file mode 100644 index 0000000..57c779a --- /dev/null +++ b/reference/_modules/creative.html @@ -0,0 +1,694 @@ + + + + + + + creative — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for creative

+# Copyright (C) 2015 Twitter, Inc.
+
+"""Container for all creative management logic used by the Ads API SDK."""
+
+from requests.exceptions import HTTPError
+from twitter_ads import API_VERSION
+from twitter_ads.cursor import Cursor
+from twitter_ads.enum import TRANSFORM
+from twitter_ads.http import Request
+from twitter_ads.resource import resource_property, Resource, Persistence, Analytics
+from twitter_ads.utils import Deprecated, FlattenParams
+
+
+
[docs]class PromotedAccount(Analytics, Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/promoted_accounts' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/promoted_accounts/{id}'
+ + +# promoted account properties +# read-only +resource_property(PromotedAccount, 'approval_status', readonly=True) +resource_property(PromotedAccount, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(PromotedAccount, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(PromotedAccount, 'entity_status', readonly=True) +resource_property(PromotedAccount, 'id', readonly=True) +resource_property(PromotedAccount, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(PromotedAccount, 'line_item_id') +resource_property(PromotedAccount, 'user_id') + + +
[docs]class PromotedTweet(Analytics, Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/promoted_tweets' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/promoted_tweets/{id}' + + @Deprecated('This method has been deprecated and will no longer be available ' + 'in the next major version update. Please use PromotedTweet.attach() ' + 'method instead.') + def save(self): + """ + Saves or updates the current object instance depending on the + presence of `object.id`. + """ + params = self.to_params() + if 'tweet_id' in params: + params['tweet_ids'] = [params['tweet_id']] + del params['tweet_id'] + + if self.id: + raise HTTPError("Method PUT not allowed.") + + resource = self.RESOURCE_COLLECTION.format(account_id=self.account.id) + response = Request(self.account.client, 'post', resource, params=params).perform() + return self.from_response(response.body['data'][0]) + + @classmethod + @FlattenParams + def attach(klass, account, **kwargs): + """ + Associate one or more Tweets with the specified line item. + """ + resource = klass.RESOURCE_COLLECTION.format(account_id=account.id) + request = Request(account.client, 'post', resource, params=kwargs) + return Cursor(klass, request, init_with=[account])
+ + +# promoted tweet properties +# read-only +resource_property(PromotedTweet, 'approval_status', readonly=True) +resource_property(PromotedTweet, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(PromotedTweet, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(PromotedTweet, 'entity_status', readonly=True) +resource_property(PromotedTweet, 'id', readonly=True) +resource_property(PromotedTweet, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(PromotedTweet, 'tweet_id') +resource_property(PromotedTweet, 'line_item_id') + + +
[docs]class AccountMedia(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/account_media' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/account_media/{id}'
+ + +# Account Media properties +# read-only +resource_property(AccountMedia, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(AccountMedia, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(AccountMedia, 'id', readonly=True) +resource_property(AccountMedia, 'creative_type', readonly=True) +resource_property(AccountMedia, 'media_url', readonly=True) +resource_property(AccountMedia, 'media_key', readonly=True) +resource_property(AccountMedia, 'updated_at', readonly=True, transform=TRANSFORM.TIME) + + +
[docs]class MediaCreative(Analytics, Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/media_creatives' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/media_creatives/{id}'
+ + +# Media Creative properties +# read-only + +resource_property(MediaCreative, 'approval_status', readonly=True) +resource_property(MediaCreative, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(MediaCreative, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(MediaCreative, 'id', readonly=True) +resource_property(MediaCreative, 'serving_status', readonly=True) +resource_property(MediaCreative, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(MediaCreative, 'account_media_id') +resource_property(MediaCreative, 'landing_url') +resource_property(MediaCreative, 'line_item_id') + + +
[docs]class WebsiteCard(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/cards/website' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/cards/website/{id}'
+ + +# website card properties +# read-only +resource_property(WebsiteCard, 'card_type', readonly=True) +resource_property(WebsiteCard, 'card_uri', readonly=True) +resource_property(WebsiteCard, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(WebsiteCard, 'id', readonly=True) +resource_property(WebsiteCard, 'media_url', readonly=True) +resource_property(WebsiteCard, 'image_display_height', readonly=True) +resource_property(WebsiteCard, 'image_display_width', readonly=True) +resource_property(WebsiteCard, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(WebsiteCard, 'website_dest_url', readonly=True) +resource_property(WebsiteCard, 'website_display_url', readonly=True) +resource_property(WebsiteCard, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(WebsiteCard, 'media_key') +resource_property(WebsiteCard, 'name') +resource_property(WebsiteCard, 'website_title') +resource_property(WebsiteCard, 'website_url') + + +
[docs]class VideoWebsiteCard(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/cards/video_website' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/cards/video_website/{id}'
+ + +# video website card properties +# read-only +resource_property(VideoWebsiteCard, 'account_id', readonly=True) +resource_property(VideoWebsiteCard, 'card_type', readonly=True) +resource_property(VideoWebsiteCard, 'card_uri', readonly=True) +resource_property(VideoWebsiteCard, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(VideoWebsiteCard, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(VideoWebsiteCard, 'id', readonly=True) +resource_property(VideoWebsiteCard, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(VideoWebsiteCard, 'video_height', readonly=True) +resource_property(VideoWebsiteCard, 'video_owner_id', readonly=True) +resource_property(VideoWebsiteCard, 'video_poster_height', readonly=True) +resource_property(VideoWebsiteCard, 'poster_media_url', readonly=True) +resource_property(VideoWebsiteCard, 'video_poster_width', readonly=True) +resource_property(VideoWebsiteCard, 'media_url', readonly=True) +resource_property(VideoWebsiteCard, 'video_width', readonly=True) +resource_property(VideoWebsiteCard, 'website_dest_url', readonly=True) +resource_property(VideoWebsiteCard, 'website_display_url', readonly=True) +# writable +resource_property(VideoWebsiteCard, 'name') +resource_property(VideoWebsiteCard, 'title') +resource_property(VideoWebsiteCard, 'media_key') +resource_property(VideoWebsiteCard, 'website_url') + + +
[docs]class ImageAppDownloadCard(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/cards/image_app_download' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/cards/image_app_download/{id}'
+ + +# image app download card properties +# read-only +resource_property(ImageAppDownloadCard, 'id', readonly=True) +resource_property(ImageAppDownloadCard, 'image_display_height', readonly=True) +resource_property(ImageAppDownloadCard, 'image_display_width', readonly=True) +resource_property(ImageAppDownloadCard, 'media_url', readonly=True) +resource_property(ImageAppDownloadCard, 'card_uri', readonly=True) +resource_property(ImageAppDownloadCard, 'card_type', readonly=True) +resource_property(ImageAppDownloadCard, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(ImageAppDownloadCard, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(ImageAppDownloadCard, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +# writable +resource_property(ImageAppDownloadCard, 'country_code') +resource_property(ImageAppDownloadCard, 'app_cta') +resource_property(ImageAppDownloadCard, 'iphone_app_id') +resource_property(ImageAppDownloadCard, 'iphone_deep_link') +resource_property(ImageAppDownloadCard, 'ipad_app_id') +resource_property(ImageAppDownloadCard, 'ipad_deep_link') +resource_property(ImageAppDownloadCard, 'googleplay_app_id') +resource_property(ImageAppDownloadCard, 'googleplay_deep_link') +resource_property(ImageAppDownloadCard, 'name') +resource_property(ImageAppDownloadCard, 'media_key') + + +
[docs]class VideoAppDownloadCard(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/cards/video_app_download' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/cards/video_app_download/{id}'
+ + +# video app download card properties +# read-only +resource_property(VideoAppDownloadCard, 'card_uri', readonly=True) +resource_property(VideoAppDownloadCard, 'card_type', readonly=True) +resource_property(VideoAppDownloadCard, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(VideoAppDownloadCard, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(VideoAppDownloadCard, 'id', readonly=True) +resource_property(VideoAppDownloadCard, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(VideoAppDownloadCard, 'video_owner_id', readonly=True) +resource_property(VideoAppDownloadCard, 'poster_media_url', readonly=True) +resource_property(VideoAppDownloadCard, 'media_url', readonly=True) +# writable +resource_property(VideoAppDownloadCard, 'country_code') +resource_property(VideoAppDownloadCard, 'app_cta') +resource_property(VideoAppDownloadCard, 'poster_media_key') +resource_property(VideoAppDownloadCard, 'ipad_app_id') +resource_property(VideoAppDownloadCard, 'ipad_deep_link') +resource_property(VideoAppDownloadCard, 'iphone_app_id') +resource_property(VideoAppDownloadCard, 'iphone_deep_link') +resource_property(VideoAppDownloadCard, 'googleplay_app_id') +resource_property(VideoAppDownloadCard, 'googleplay_deep_link') +resource_property(VideoAppDownloadCard, 'name') +resource_property(VideoAppDownloadCard, 'media_key') + + +
[docs]class ImageConversationCard(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/cards/image_conversation' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/cards/image_conversation/{id}'
+ + +# image conversation card properties +# read-only +resource_property(ImageConversationCard, 'card_type', readonly=True) +resource_property(ImageConversationCard, 'card_uri', readonly=True) +resource_property(ImageConversationCard, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(ImageConversationCard, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(ImageConversationCard, 'id', readonly=True) +resource_property(ImageConversationCard, 'media_url', readonly=True) +resource_property(ImageConversationCard, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(ImageConversationCard, 'unlocked_image_media_key') +resource_property(ImageConversationCard, 'fouth_cta') +resource_property(ImageConversationCard, 'fouth_cta_tweet') +resource_property(ImageConversationCard, 'media_key') +resource_property(ImageConversationCard, 'first_cta') +resource_property(ImageConversationCard, 'first_cta_tweet') +resource_property(ImageConversationCard, 'name') +resource_property(ImageConversationCard, 'second_cta') +resource_property(ImageConversationCard, 'second_cta_tweet') +resource_property(ImageConversationCard, 'thank_you_text') +resource_property(ImageConversationCard, 'thank_you_url') +resource_property(ImageConversationCard, 'third_cta') +resource_property(ImageConversationCard, 'third_cta_tweet') +resource_property(ImageConversationCard, 'title') + + +
[docs]class VideoConversationCard(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/cards/video_conversation' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/cards/video_conversation/{id}'
+ + +# video conversation card properties +# read-only + +resource_property(VideoConversationCard, 'card_uri', readonly=True) +resource_property(VideoConversationCard, 'card_type', readonly=True) +resource_property(VideoConversationCard, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(VideoConversationCard, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(VideoConversationCard, 'id', readonly=True) +resource_property(VideoConversationCard, 'media_url', readonly=True) +resource_property(VideoConversationCard, 'poster_media_url', readonly=True) +resource_property(VideoConversationCard, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(ImageConversationCard, 'unlocked_image_media_key') +resource_property(ImageConversationCard, 'unlocked_video_media_key') +resource_property(ImageConversationCard, 'fouth_cta') +resource_property(ImageConversationCard, 'fouth_cta_tweet') +resource_property(ImageConversationCard, 'poster_media_key') +resource_property(ImageConversationCard, 'first_cta') +resource_property(ImageConversationCard, 'first_cta_tweet') +resource_property(ImageConversationCard, 'name') +resource_property(ImageConversationCard, 'second_cta') +resource_property(ImageConversationCard, 'second_cta_tweet') +resource_property(ImageConversationCard, 'thank_you_text') +resource_property(ImageConversationCard, 'thank_you_url') +resource_property(ImageConversationCard, 'third_cta') +resource_property(ImageConversationCard, 'third_cta_tweet') +resource_property(ImageConversationCard, 'title') +resource_property(ImageConversationCard, 'media_key') + + +
[docs]class ScheduledTweet(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/scheduled_tweets' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/scheduled_tweets/{id}'
+ + +# scheduled tweet properties +# read-only +resource_property(ScheduledTweet, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(ScheduledTweet, 'completed_at', read_only=True, transform=TRANSFORM.TIME) +resource_property(ScheduledTweet, 'id', read_only=True) +resource_property(ScheduledTweet, 'id_str', read_only=True) +resource_property(ScheduledTweet, 'scheduled_status', read_only=True) +resource_property(ScheduledTweet, 'tweet_id', readonly=True) +resource_property(ScheduledTweet, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(ScheduledTweet, 'user_id', read_only=True) +# writable +resource_property(ScheduledTweet, 'as_user_id') +resource_property(ScheduledTweet, 'card_uri') +resource_property(ScheduledTweet, 'media_keys', transform=TRANSFORM.LIST) +resource_property(ScheduledTweet, 'nullcast', transform=TRANSFORM.BOOL) +resource_property(ScheduledTweet, 'scheduled_at', transform=TRANSFORM.TIME) +resource_property(ScheduledTweet, 'text') + + +
[docs]class DraftTweet(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/draft_tweets' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/draft_tweets/{id}'
+ + +# draft tweet properties +# read-only +resource_property(DraftTweet, 'id', read_only=True) +resource_property(DraftTweet, 'id_str', read_only=True) +resource_property(DraftTweet, 'created_at', read_only=True, transform=TRANSFORM.TIME) +resource_property(DraftTweet, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(DraftTweet, 'user_id', read_only=True) +# writable +resource_property(DraftTweet, 'as_user_id') +resource_property(DraftTweet, 'card_uri') +resource_property(DraftTweet, 'media_keys', transform=TRANSFORM.LIST) +resource_property(DraftTweet, 'nullcast', transform=TRANSFORM.BOOL) +resource_property(DraftTweet, 'text') + + +
[docs]class MediaLibrary(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/media_library' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/media_library/{id}' + +
[docs] def reload(self, **kwargs): + if not self.media_key: + return self + + resource = self.RESOURCE.format(account_id=self.account.id, id=self.media_key) + response = Request(self.account.client, 'get', resource, params=kwargs).perform() + + return self.from_response(response.body['data'])
+ +
[docs] def save(self): + if self.media_key: + method = 'put' + resource = self.RESOURCE.format(account_id=self.account.id, id=self.media_key) + else: + method = 'post' + resource = self.RESOURCE_COLLECTION.format(account_id=self.account.id) + + response = Request( + self.account.client, method, + resource, params=self.to_params()).perform() + + return self.from_response(response.body['data'])
+ +
[docs] def delete(self): + resource = self.RESOURCE.format(account_id=self.account.id, id=self.media_key) + response = Request(self.account.client, 'delete', resource).perform() + self.from_response(response.body['data'])
+ + +# media library properties +# read-only +resource_property(MediaLibrary, 'aspect_ratio', readonly=True) +resource_property(MediaLibrary, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(MediaLibrary, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(MediaLibrary, 'duration', readonly=True, transform=TRANSFORM.INT) +resource_property(MediaLibrary, 'media_status', readonly=True) +resource_property(MediaLibrary, 'media_type', readonly=True) +resource_property(MediaLibrary, 'media_url', readonly=True) +resource_property(MediaLibrary, 'poster_media_url', readonly=True) +resource_property(MediaLibrary, 'tweeted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(MediaLibrary, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +# writable +resource_property(MediaLibrary, 'media_key') +resource_property(MediaLibrary, 'description') +resource_property(MediaLibrary, 'file_name') +resource_property(MediaLibrary, 'name') +resource_property(MediaLibrary, 'poster_media_key') +resource_property(MediaLibrary, 'title') + + +
[docs]class PollCard(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/cards/poll' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/cards/poll/{id}'
+ + +# poll card properties +# read-only +resource_property(PollCard, 'card_type', readonly=True) +resource_property(PollCard, 'card_uri', readonly=True) +resource_property(PollCard, 'content_duration_seconds', readonly=True) +resource_property(PollCard, 'created_at', readonly=True) +resource_property(PollCard, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(PollCard, 'end_time', readonly=True) +resource_property(PollCard, 'id', readonly=True) +resource_property(PollCard, 'image', readonly=True) +resource_property(PollCard, 'image_display_height', readonly=True) +resource_property(PollCard, 'image_display_width', readonly=True) +resource_property(PollCard, 'start_time', readonly=True) +resource_property(PollCard, 'updated_at', readonly=True) +resource_property(PollCard, 'video_height', readonly=True) +resource_property(PollCard, 'video_hls_url', readonly=True) +resource_property(PollCard, 'video_poster_height', readonly=True) +resource_property(PollCard, 'video_poster_url', readonly=True) +resource_property(PollCard, 'video_poster_width', readonly=True) +resource_property(PollCard, 'video_url', readonly=True) +resource_property(PollCard, 'video_width', readonly=True) +# writable +resource_property(PollCard, 'duration_in_minutes') +resource_property(PollCard, 'first_choice') +resource_property(PollCard, 'fourth_choice') +resource_property(PollCard, 'media_key') +resource_property(PollCard, 'name') +resource_property(PollCard, 'second_choice') +resource_property(PollCard, 'third_choice') + + +
[docs]class CardsFetch(Resource): + + PROPERTIES = {} + + FETCH_URI = '/' + API_VERSION + '/accounts/{account_id}/cards/all' + FETCH_ID = '/' + API_VERSION + '/accounts/{account_id}/cards/all/{id}' + +
[docs] def all(klass): + raise AttributeError("'CardsFetch' object has no attribute 'all'")
+ + @classmethod + @FlattenParams + def load(klass, account, **kwargs): + # check whether both are specified or neither are specified + if all([kwargs.get('card_uris'), kwargs.get('card_id')]) or \ + not any([kwargs.get('card_uris'), kwargs.get('card_id')]): + raise ValueError('card_uris and card_id are exclusive parameters. ' + + 'Please supply one or the other, but not both.') + + if kwargs.get('card_uris'): + resource = klass.FETCH_URI.format(account_id=account.id) + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(klass, request, init_with=[account]) + else: + resource = klass.FETCH_ID.format(account_id=account.id, id=kwargs.get('card_id')) + response = Request(account.client, 'get', resource, params=kwargs).perform() + return klass(account).from_response(response.body['data']) + +
[docs] def reload(self): + if self.id: + self.load(self.account, card_id=self.id)
+ + +# card properties +# read-only +resource_property(CardsFetch, 'country_code', readonly=True) +resource_property(CardsFetch, 'app_cta', readonly=True) +resource_property(CardsFetch, 'card_type', readonly=True) +resource_property(CardsFetch, 'card_uri', readonly=True) +resource_property(CardsFetch, 'content_duration_seconds', readonly=True) +resource_property(CardsFetch, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(CardsFetch, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(CardsFetch, 'duration_in_minutes', readonly=True) +resource_property(CardsFetch, 'end_time', readonly=True, transform=TRANSFORM.TIME) +resource_property(CardsFetch, 'first_choice', readonly=True) +resource_property(CardsFetch, 'first_cta', readonly=True) +resource_property(CardsFetch, 'first_cta_tweet', readonly=True) +resource_property(CardsFetch, 'first_cta_welcome_message_id', readonly=True) +resource_property(CardsFetch, 'fouth_choice', readonly=True) +resource_property(CardsFetch, 'fouth_cta', readonly=True) +resource_property(CardsFetch, 'fouth_cta_tweet', readonly=True) +resource_property(CardsFetch, 'fourth_cta_welcome_message_id', readonly=True) +resource_property(CardsFetch, 'googleplay_app_id', readonly=True) +resource_property(CardsFetch, 'googleplay_deep_link', readonly=True) +resource_property(CardsFetch, 'id', readonly=True) +resource_property(CardsFetch, 'image', readonly=True) +resource_property(CardsFetch, 'image_display_height', readonly=True) +resource_property(CardsFetch, 'image_display_width', readonly=True) +resource_property(CardsFetch, 'ipad_app_id', readonly=True) +resource_property(CardsFetch, 'ipad_deep_link', readonly=True) +resource_property(CardsFetch, 'iphone_app_id', readonly=True) +resource_property(CardsFetch, 'iphone_deep_link', readonly=True) +resource_property(CardsFetch, 'name', readonly=True) +resource_property(CardsFetch, 'recipient_user_id', readonly=True) +resource_property(CardsFetch, 'second_choice', readonly=True) +resource_property(CardsFetch, 'second_cta', readonly=True) +resource_property(CardsFetch, 'second_cta_tweet', readonly=True) +resource_property(CardsFetch, 'second_cta_welcome_message_id', readonly=True) +resource_property(CardsFetch, 'start_time', readonly=True, transform=TRANSFORM.TIME) +resource_property(CardsFetch, 'thank_you_text', readonly=True) +resource_property(CardsFetch, 'thank_you_url', readonly=True) +resource_property(CardsFetch, 'third_choice', readonly=True) +resource_property(CardsFetch, 'third_cta', readonly=True) +resource_property(CardsFetch, 'third_cta_tweet', readonly=True) +resource_property(CardsFetch, 'third_cta_welcome_message_id', readonly=True) +resource_property(CardsFetch, 'title', readonly=True) +resource_property(CardsFetch, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(CardsFetch, 'video_content_id', readonly=True) +resource_property(CardsFetch, 'video_height', readonly=True) +resource_property(CardsFetch, 'video_hls_url', readonly=True) +resource_property(CardsFetch, 'video_owner_id', readonly=True) +resource_property(CardsFetch, 'video_poster_height', readonly=True) +resource_property(CardsFetch, 'video_poster_url', readonly=True) +resource_property(CardsFetch, 'video_poster_width', readonly=True) +resource_property(CardsFetch, 'video_width', readonly=True) +resource_property(CardsFetch, 'video_url', readonly=True) +resource_property(CardsFetch, 'website_dest_url', readonly=True) +resource_property(CardsFetch, 'website_display_url', readonly=True) +resource_property(CardsFetch, 'website_shortened_url', readonly=True) +resource_property(CardsFetch, 'website_title', readonly=True) +resource_property(CardsFetch, 'website_url', readonly=True) +resource_property(CardsFetch, 'wide_app_image', readonly=True) + + +
[docs]class TweetPreview(Resource): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/tweet_previews' + + @classmethod + @FlattenParams + def load(klass, account, **kwargs): + resource = klass.RESOURCE_COLLECTION.format(account_id=account.id) + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(klass, request, init_with=[account])
+ + +# tweet preview properties +# read-only +resource_property(TweetPreview, 'preview', readonly=True) +resource_property(TweetPreview, 'tweet_id', readonly=True) +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/cursor.html b/reference/_modules/cursor.html new file mode 100644 index 0000000..b2d46c9 --- /dev/null +++ b/reference/_modules/cursor.html @@ -0,0 +1,219 @@ + + + + + + + cursor — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for cursor

+# Copyright (C) 2015 Twitter, Inc.
+
+"""Container for all Cursor logic used by the Ads API SDK."""
+
+# from twitter_ads import *
+from twitter_ads.http import Request
+from twitter_ads.utils import extract_response_headers
+
+
+
[docs]class Cursor(object): + """ + The Ads API Client class which functions as a container for basic + API consumer information. + """ + + def __init__(self, klass, request, **kwargs): + self._klass = klass + self._client = request.client + self._method = request.method + self._resource = request.resource + + self._options = kwargs.copy() + self._options.update(request.options) + + self._collection = [] + self._current_index = 0 + self._next_cursor = None + self._total_count = 0 + + self.__from_response(request.perform()) + + @property + def exhausted(self): + """ + Returns True if the custor instance is exhausted. + """ + return False if self._next_cursor else True + + @property + def count(self): + """ + Returns the total number of items available to this cursor instance. + """ + return self._total_count or len(self._collection) + + @property + def first(self): + """ + Returns the first item of available items available to the cursor instance. + """ + return next(iter(self._collection), None) + + @property + def fetched(self): + """ + Returns the number of items fetched so far. + """ + return len(self._collection) + + def __iter__(self): + return self + +
[docs] def next(self): + """Returns the next item in the cursor.""" + if self._current_index < len(self._collection): + value = self._collection[self._current_index] + self._current_index += 1 + return value + elif self._next_cursor: + self.__fetch_next() + return self.next() + else: + self._current_index = 0 + raise StopIteration
+ + __next__ = next + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.__die() + + def __fetch_next(self): + options = self._options.copy() + params = options.get('params', {}) + params.update({'cursor': self._next_cursor}) + options['params'] = params + response = Request(self._client, self._method, self._resource, **options).perform() + return self.__from_response(response) + + def __from_response(self, response): + self._next_cursor = response.body.get('next_cursor', None) + if 'total_count' in response.body: + self._total_count = int(response.body['total_count']) + + limits = extract_response_headers(response.headers) + for k in limits: + setattr(self, k, limits[k]) + + for item in response.body['data']: + if 'from_response' in dir(self._klass): + init_with = self._options.get('init_with', None) + obj = self._klass(*init_with) if init_with else self._klass() + self._collection.append(obj.from_response(item)) + else: + self._collection.append(item)
+
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/enum.html b/reference/_modules/enum.html new file mode 100644 index 0000000..809a74b --- /dev/null +++ b/reference/_modules/enum.html @@ -0,0 +1,1022 @@ + + + + + + + enum — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for enum

+import sys
+from types import MappingProxyType, DynamicClassAttribute
+
+# try _collections first to reduce startup cost
+try:
+    from _collections import OrderedDict
+except ImportError:
+    from collections import OrderedDict
+
+
+__all__ = [
+        'EnumMeta',
+        'Enum', 'IntEnum', 'Flag', 'IntFlag',
+        'auto', 'unique',
+        ]
+
+
+def _is_descriptor(obj):
+    """Returns True if obj is a descriptor, False otherwise."""
+    return (
+            hasattr(obj, '__get__') or
+            hasattr(obj, '__set__') or
+            hasattr(obj, '__delete__'))
+
+
+def _is_dunder(name):
+    """Returns True if a __dunder__ name, False otherwise."""
+    return (len(name) > 4 and
+            name[:2] == name[-2:] == '__' and
+            name[2] != '_' and
+            name[-3] != '_')
+
+
+def _is_sunder(name):
+    """Returns True if a _sunder_ name, False otherwise."""
+    return (len(name) > 2 and
+            name[0] == name[-1] == '_' and
+            name[1:2] != '_' and
+            name[-2:-1] != '_')
+
+
+def _make_class_unpicklable(cls):
+    """Make the given class un-picklable."""
+    def _break_on_call_reduce(self, proto):
+        raise TypeError('%r cannot be pickled' % self)
+    cls.__reduce_ex__ = _break_on_call_reduce
+    cls.__module__ = '<unknown>'
+
+_auto_null = object()
+
[docs]class auto: + """ + Instances are replaced with an appropriate value in Enum class suites. + """ + value = _auto_null
+ + +class _EnumDict(dict): + """Track enum member order and ensure member names are not reused. + + EnumMeta will use the names found in self._member_names as the + enumeration member names. + + """ + def __init__(self): + super().__init__() + self._member_names = [] + self._last_values = [] + self._ignore = [] + + def __setitem__(self, key, value): + """Changes anything not dundered or not a descriptor. + + If an enum member name is used twice, an error is raised; duplicate + values are not checked for. + + Single underscore (sunder) names are reserved. + + """ + if _is_sunder(key): + if key not in ( + '_order_', '_create_pseudo_member_', + '_generate_next_value_', '_missing_', '_ignore_', + ): + raise ValueError('_names_ are reserved for future Enum use') + if key == '_generate_next_value_': + setattr(self, '_generate_next_value', value) + elif key == '_ignore_': + if isinstance(value, str): + value = value.replace(',',' ').split() + else: + value = list(value) + self._ignore = value + already = set(value) & set(self._member_names) + if already: + raise ValueError('_ignore_ cannot specify already set names: %r' % (already, )) + elif _is_dunder(key): + if key == '__order__': + key = '_order_' + elif key in self._member_names: + # descriptor overwriting an enum? + raise TypeError('Attempted to reuse key: %r' % key) + elif key in self._ignore: + pass + elif not _is_descriptor(value): + if key in self: + # enum overwriting a descriptor? + raise TypeError('%r already defined as: %r' % (key, self[key])) + if isinstance(value, auto): + if value.value == _auto_null: + value.value = self._generate_next_value(key, 1, len(self._member_names), self._last_values[:]) + value = value.value + self._member_names.append(key) + self._last_values.append(value) + super().__setitem__(key, value) + + +# Dummy value for Enum as EnumMeta explicitly checks for it, but of course +# until EnumMeta finishes running the first time the Enum class doesn't exist. +# This is also why there are checks in EnumMeta like `if Enum is not None` +Enum = None + + +
[docs]class EnumMeta(type): + """Metaclass for Enum""" + @classmethod + def __prepare__(metacls, cls, bases): + # create the namespace dict + enum_dict = _EnumDict() + # inherit previous flags and _generate_next_value_ function + member_type, first_enum = metacls._get_mixins_(bases) + if first_enum is not None: + enum_dict['_generate_next_value_'] = getattr(first_enum, '_generate_next_value_', None) + return enum_dict + + def __new__(metacls, cls, bases, classdict): + # an Enum class is final once enumeration items have been defined; it + # cannot be mixed with other types (int, float, etc.) if it has an + # inherited __new__ unless a new __new__ is defined (or the resulting + # class will fail). + # + # remove any keys listed in _ignore_ + classdict.setdefault('_ignore_', []).append('_ignore_') + ignore = classdict['_ignore_'] + for key in ignore: + classdict.pop(key, None) + member_type, first_enum = metacls._get_mixins_(bases) + __new__, save_new, use_args = metacls._find_new_(classdict, member_type, + first_enum) + + # save enum items into separate mapping so they don't get baked into + # the new class + enum_members = {k: classdict[k] for k in classdict._member_names} + for name in classdict._member_names: + del classdict[name] + + # adjust the sunders + _order_ = classdict.pop('_order_', None) + + # check for illegal enum names (any others?) + invalid_names = set(enum_members) & {'mro', ''} + if invalid_names: + raise ValueError('Invalid enum member name: {0}'.format( + ','.join(invalid_names))) + + # create a default docstring if one has not been provided + if '__doc__' not in classdict: + classdict['__doc__'] = 'An enumeration.' + + # create our new Enum type + enum_class = super().__new__(metacls, cls, bases, classdict) + enum_class._member_names_ = [] # names in definition order + enum_class._member_map_ = OrderedDict() # name->value map + enum_class._member_type_ = member_type + + # save DynamicClassAttribute attributes from super classes so we know + # if we can take the shortcut of storing members in the class dict + dynamic_attributes = {k for c in enum_class.mro() + for k, v in c.__dict__.items() + if isinstance(v, DynamicClassAttribute)} + + # Reverse value->name map for hashable values. + enum_class._value2member_map_ = {} + + # If a custom type is mixed into the Enum, and it does not know how + # to pickle itself, pickle.dumps will succeed but pickle.loads will + # fail. Rather than have the error show up later and possibly far + # from the source, sabotage the pickle protocol for this class so + # that pickle.dumps also fails. + # + # However, if the new class implements its own __reduce_ex__, do not + # sabotage -- it's on them to make sure it works correctly. We use + # __reduce_ex__ instead of any of the others as it is preferred by + # pickle over __reduce__, and it handles all pickle protocols. + if '__reduce_ex__' not in classdict: + if member_type is not object: + methods = ('__getnewargs_ex__', '__getnewargs__', + '__reduce_ex__', '__reduce__') + if not any(m in member_type.__dict__ for m in methods): + _make_class_unpicklable(enum_class) + + # instantiate them, checking for duplicates as we go + # we instantiate first instead of checking for duplicates first in case + # a custom __new__ is doing something funky with the values -- such as + # auto-numbering ;) + for member_name in classdict._member_names: + value = enum_members[member_name] + if not isinstance(value, tuple): + args = (value, ) + else: + args = value + if member_type is tuple: # special case for tuple enums + args = (args, ) # wrap it one more time + if not use_args: + enum_member = __new__(enum_class) + if not hasattr(enum_member, '_value_'): + enum_member._value_ = value + else: + enum_member = __new__(enum_class, *args) + if not hasattr(enum_member, '_value_'): + if member_type is object: + enum_member._value_ = value + else: + enum_member._value_ = member_type(*args) + value = enum_member._value_ + enum_member._name_ = member_name + enum_member.__objclass__ = enum_class + enum_member.__init__(*args) + # If another member with the same value was already defined, the + # new member becomes an alias to the existing one. + for name, canonical_member in enum_class._member_map_.items(): + if canonical_member._value_ == enum_member._value_: + enum_member = canonical_member + break + else: + # Aliases don't appear in member names (only in __members__). + enum_class._member_names_.append(member_name) + # performance boost for any member that would not shadow + # a DynamicClassAttribute + if member_name not in dynamic_attributes: + setattr(enum_class, member_name, enum_member) + # now add to _member_map_ + enum_class._member_map_[member_name] = enum_member + try: + # This may fail if value is not hashable. We can't add the value + # to the map, and by-value lookups for this value will be + # linear. + enum_class._value2member_map_[value] = enum_member + except TypeError: + pass + + # double check that repr and friends are not the mixin's or various + # things break (such as pickle) + for name in ('__repr__', '__str__', '__format__', '__reduce_ex__'): + class_method = getattr(enum_class, name) + obj_method = getattr(member_type, name, None) + enum_method = getattr(first_enum, name, None) + if obj_method is not None and obj_method is class_method: + setattr(enum_class, name, enum_method) + + # replace any other __new__ with our own (as long as Enum is not None, + # anyway) -- again, this is to support pickle + if Enum is not None: + # if the user defined their own __new__, save it before it gets + # clobbered in case they subclass later + if save_new: + enum_class.__new_member__ = __new__ + enum_class.__new__ = Enum.__new__ + + # py3 support for definition order (helps keep py2/py3 code in sync) + if _order_ is not None: + if isinstance(_order_, str): + _order_ = _order_.replace(',', ' ').split() + if _order_ != enum_class._member_names_: + raise TypeError('member order does not match _order_') + + return enum_class + + def __bool__(self): + """ + classes/types should always be True. + """ + return True + + def __call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1): + """Either returns an existing member, or creates a new enum class. + + This method is used both when an enum class is given a value to match + to an enumeration member (i.e. Color(3)) and for the functional API + (i.e. Color = Enum('Color', names='RED GREEN BLUE')). + + When used for the functional API: + + `value` will be the name of the new class. + + `names` should be either a string of white-space/comma delimited names + (values will start at `start`), or an iterator/mapping of name, value pairs. + + `module` should be set to the module this class is being created in; + if it is not set, an attempt to find that module will be made, but if + it fails the class will not be picklable. + + `qualname` should be set to the actual location this class can be found + at in its module; by default it is set to the global scope. If this is + not correct, unpickling will fail in some circumstances. + + `type`, if set, will be mixed in as the first base class. + + """ + if names is None: # simple value lookup + return cls.__new__(cls, value) + # otherwise, functional API: we're creating a new Enum type + return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start) + + def __contains__(cls, member): + if not isinstance(member, Enum): + import warnings + warnings.warn( + "using non-Enums in containment checks will raise " + "TypeError in Python 3.8", + DeprecationWarning, 2) + return isinstance(member, cls) and member._name_ in cls._member_map_ + + def __delattr__(cls, attr): + # nicer error message when someone tries to delete an attribute + # (see issue19025). + if attr in cls._member_map_: + raise AttributeError( + "%s: cannot delete Enum member." % cls.__name__) + super().__delattr__(attr) + + def __dir__(self): + return (['__class__', '__doc__', '__members__', '__module__'] + + self._member_names_) + + def __getattr__(cls, name): + """Return the enum member matching `name` + + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + + """ + if _is_dunder(name): + raise AttributeError(name) + try: + return cls._member_map_[name] + except KeyError: + raise AttributeError(name) from None + + def __getitem__(cls, name): + return cls._member_map_[name] + + def __iter__(cls): + return (cls._member_map_[name] for name in cls._member_names_) + + def __len__(cls): + return len(cls._member_names_) + + @property + def __members__(cls): + """Returns a mapping of member name->value. + + This mapping lists all enum members, including aliases. Note that this + is a read-only view of the internal mapping. + + """ + return MappingProxyType(cls._member_map_) + + def __repr__(cls): + return "<enum %r>" % cls.__name__ + + def __reversed__(cls): + return (cls._member_map_[name] for name in reversed(cls._member_names_)) + + def __setattr__(cls, name, value): + """Block attempts to reassign Enum members. + + A simple assignment to the class namespace only changes one of the + several possible ways to get an Enum member from the Enum class, + resulting in an inconsistent Enumeration. + + """ + member_map = cls.__dict__.get('_member_map_', {}) + if name in member_map: + raise AttributeError('Cannot reassign members.') + super().__setattr__(name, value) + + def _create_(cls, class_name, names, *, module=None, qualname=None, type=None, start=1): + """Convenience method to create a new Enum class. + + `names` can be: + + * A string containing member names, separated either with spaces or + commas. Values are incremented by 1 from `start`. + * An iterable of member names. Values are incremented by 1 from `start`. + * An iterable of (member name, value) pairs. + * A mapping of member name -> value pairs. + + """ + metacls = cls.__class__ + bases = (cls, ) if type is None else (type, cls) + _, first_enum = cls._get_mixins_(bases) + classdict = metacls.__prepare__(class_name, bases) + + # special processing needed for names? + if isinstance(names, str): + names = names.replace(',', ' ').split() + if isinstance(names, (tuple, list)) and names and isinstance(names[0], str): + original_names, names = names, [] + last_values = [] + for count, name in enumerate(original_names): + value = first_enum._generate_next_value_(name, start, count, last_values[:]) + last_values.append(value) + names.append((name, value)) + + # Here, names is either an iterable of (name, value) or a mapping. + for item in names: + if isinstance(item, str): + member_name, member_value = item, names[item] + else: + member_name, member_value = item + classdict[member_name] = member_value + enum_class = metacls.__new__(metacls, class_name, bases, classdict) + + # TODO: replace the frame hack if a blessed way to know the calling + # module is ever developed + if module is None: + try: + module = sys._getframe(2).f_globals['__name__'] + except (AttributeError, ValueError, KeyError) as exc: + pass + if module is None: + _make_class_unpicklable(enum_class) + else: + enum_class.__module__ = module + if qualname is not None: + enum_class.__qualname__ = qualname + + return enum_class + + @staticmethod + def _get_mixins_(bases): + """Returns the type for creating enum members, and the first inherited + enum class. + + bases: the tuple of bases that was given to __new__ + + """ + if not bases: + return object, Enum + + def _find_data_type(bases): + for chain in bases: + for base in chain.__mro__: + if base is object: + continue + elif '__new__' in base.__dict__: + if issubclass(base, Enum): + continue + return base + + # ensure final parent class is an Enum derivative, find any concrete + # data type, and check that Enum has no members + first_enum = bases[-1] + if not issubclass(first_enum, Enum): + raise TypeError("new enumerations should be created as " + "`EnumName([mixin_type, ...] [data_type,] enum_type)`") + member_type = _find_data_type(bases) or object + if first_enum._member_names_: + raise TypeError("Cannot extend enumerations") + return member_type, first_enum + + @staticmethod + def _find_new_(classdict, member_type, first_enum): + """Returns the __new__ to be used for creating the enum members. + + classdict: the class dictionary given to __new__ + member_type: the data type whose __new__ will be used by default + first_enum: enumeration to check for an overriding __new__ + + """ + # now find the correct __new__, checking to see of one was defined + # by the user; also check earlier enum classes in case a __new__ was + # saved as __new_member__ + __new__ = classdict.get('__new__', None) + + # should __new__ be saved as __new_member__ later? + save_new = __new__ is not None + + if __new__ is None: + # check all possibles for __new_member__ before falling back to + # __new__ + for method in ('__new_member__', '__new__'): + for possible in (member_type, first_enum): + target = getattr(possible, method, None) + if target not in { + None, + None.__new__, + object.__new__, + Enum.__new__, + }: + __new__ = target + break + if __new__ is not None: + break + else: + __new__ = object.__new__ + + # if a non-object.__new__ is used then whatever value/tuple was + # assigned to the enum member name will be passed to __new__ and to the + # new enum member's __init__ + if __new__ is object.__new__: + use_args = False + else: + use_args = True + return __new__, save_new, use_args
+ + +
[docs]class Enum(metaclass=EnumMeta): + """Generic enumeration. + + Derive from this class to define new enumerations. + + """ + def __new__(cls, value): + # all enum instances are actually created during class construction + # without calling this method; this method is called by the metaclass' + # __call__ (i.e. Color(3) ), and by pickle + if type(value) is cls: + # For lookups like Color(Color.RED) + return value + # by-value search for a matching enum member + # see if it's in the reverse mapping (for hashable values) + try: + return cls._value2member_map_[value] + except KeyError: + # Not found, no need to do long O(n) search + pass + except TypeError: + # not there, now do long search -- O(n) behavior + for member in cls._member_map_.values(): + if member._value_ == value: + return member + # still not found -- try _missing_ hook + try: + exc = None + result = cls._missing_(value) + except Exception as e: + exc = e + result = None + if isinstance(result, cls): + return result + else: + ve_exc = ValueError("%r is not a valid %s" % (value, cls.__name__)) + if result is None and exc is None: + raise ve_exc + elif exc is None: + exc = TypeError( + 'error in %s._missing_: returned %r instead of None or a valid member' + % (cls.__name__, result) + ) + exc.__context__ = ve_exc + raise exc + + def _generate_next_value_(name, start, count, last_values): + for last_value in reversed(last_values): + try: + return last_value + 1 + except TypeError: + pass + else: + return start + + @classmethod + def _missing_(cls, value): + raise ValueError("%r is not a valid %s" % (value, cls.__name__)) + + def __repr__(self): + return "<%s.%s: %r>" % ( + self.__class__.__name__, self._name_, self._value_) + + def __str__(self): + return "%s.%s" % (self.__class__.__name__, self._name_) + + def __dir__(self): + added_behavior = [ + m + for cls in self.__class__.mro() + for m in cls.__dict__ + if m[0] != '_' and m not in self._member_map_ + ] + return (['__class__', '__doc__', '__module__'] + added_behavior) + + def __format__(self, format_spec): + # mixed-in Enums should use the mixed-in type's __format__, otherwise + # we can get strange results with the Enum name showing up instead of + # the value + + # pure Enum branch + if self._member_type_ is object: + cls = str + val = str(self) + # mix-in branch + else: + cls = self._member_type_ + val = self._value_ + return cls.__format__(val, format_spec) + + def __hash__(self): + return hash(self._name_) + + def __reduce_ex__(self, proto): + return self.__class__, (self._value_, ) + + # DynamicClassAttribute is used to provide access to the `name` and + # `value` properties of enum members while keeping some measure of + # protection from modification, while still allowing for an enumeration + # to have members named `name` and `value`. This works because enumeration + # members are not set directly on the enum class -- __getattr__ is + # used to look them up. + + @DynamicClassAttribute + def name(self): + """The name of the Enum member.""" + return self._name_ + + @DynamicClassAttribute + def value(self): + """The value of the Enum member.""" + return self._value_ + + @classmethod + def _convert(cls, name, module, filter, source=None): + """ + Create a new Enum subclass that replaces a collection of global constants + """ + # convert all constants from source (or module) that pass filter() to + # a new Enum called name, and export the enum and its members back to + # module; + # also, replace the __reduce_ex__ method so unpickling works in + # previous Python versions + module_globals = vars(sys.modules[module]) + if source: + source = vars(source) + else: + source = module_globals + # We use an OrderedDict of sorted source keys so that the + # _value2member_map is populated in the same order every time + # for a consistent reverse mapping of number to name when there + # are multiple names for the same number rather than varying + # between runs due to hash randomization of the module dictionary. + members = [ + (name, source[name]) + for name in source.keys() + if filter(name)] + try: + # sort by value + members.sort(key=lambda t: (t[1], t[0])) + except TypeError: + # unless some values aren't comparable, in which case sort by name + members.sort(key=lambda t: t[0]) + cls = cls(name, members, module=module) + cls.__reduce_ex__ = _reduce_ex_by_name + module_globals.update(cls.__members__) + module_globals[name] = cls + return cls
+ + +
[docs]class IntEnum(int, Enum): + """Enum where members are also (and must be) ints"""
+ + +def _reduce_ex_by_name(self, proto): + return self.name + +
[docs]class Flag(Enum): + """Support for flags""" + + def _generate_next_value_(name, start, count, last_values): + """ + Generate the next value when not given. + + name: the name of the member + start: the initital start value or None + count: the number of existing members + last_value: the last value assigned or None + """ + if not count: + return start if start is not None else 1 + for last_value in reversed(last_values): + try: + high_bit = _high_bit(last_value) + break + except Exception: + raise TypeError('Invalid Flag value: %r' % last_value) from None + return 2 ** (high_bit+1) + + @classmethod + def _missing_(cls, value): + original_value = value + if value < 0: + value = ~value + possible_member = cls._create_pseudo_member_(value) + if original_value < 0: + possible_member = ~possible_member + return possible_member + + @classmethod + def _create_pseudo_member_(cls, value): + """ + Create a composite member iff value contains only members. + """ + pseudo_member = cls._value2member_map_.get(value, None) + if pseudo_member is None: + # verify all bits are accounted for + _, extra_flags = _decompose(cls, value) + if extra_flags: + raise ValueError("%r is not a valid %s" % (value, cls.__name__)) + # construct a singleton enum pseudo-member + pseudo_member = object.__new__(cls) + pseudo_member._name_ = None + pseudo_member._value_ = value + # use setdefault in case another thread already created a composite + # with this value + pseudo_member = cls._value2member_map_.setdefault(value, pseudo_member) + return pseudo_member + + def __contains__(self, other): + if not isinstance(other, self.__class__): + import warnings + warnings.warn( + "using non-Flags in containment checks will raise " + "TypeError in Python 3.8", + DeprecationWarning, 2) + return False + return other._value_ & self._value_ == other._value_ + + def __repr__(self): + cls = self.__class__ + if self._name_ is not None: + return '<%s.%s: %r>' % (cls.__name__, self._name_, self._value_) + members, uncovered = _decompose(cls, self._value_) + return '<%s.%s: %r>' % ( + cls.__name__, + '|'.join([str(m._name_ or m._value_) for m in members]), + self._value_, + ) + + def __str__(self): + cls = self.__class__ + if self._name_ is not None: + return '%s.%s' % (cls.__name__, self._name_) + members, uncovered = _decompose(cls, self._value_) + if len(members) == 1 and members[0]._name_ is None: + return '%s.%r' % (cls.__name__, members[0]._value_) + else: + return '%s.%s' % ( + cls.__name__, + '|'.join([str(m._name_ or m._value_) for m in members]), + ) + + def __bool__(self): + return bool(self._value_) + + def __or__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return self.__class__(self._value_ | other._value_) + + def __and__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return self.__class__(self._value_ & other._value_) + + def __xor__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return self.__class__(self._value_ ^ other._value_) + + def __invert__(self): + members, uncovered = _decompose(self.__class__, self._value_) + inverted = self.__class__(0) + for m in self.__class__: + if m not in members and not (m._value_ & self._value_): + inverted = inverted | m + return self.__class__(inverted)
+ + +
[docs]class IntFlag(int, Flag): + """Support for integer-based Flags""" + + @classmethod + def _missing_(cls, value): + if not isinstance(value, int): + raise ValueError("%r is not a valid %s" % (value, cls.__name__)) + new_member = cls._create_pseudo_member_(value) + return new_member + + @classmethod + def _create_pseudo_member_(cls, value): + pseudo_member = cls._value2member_map_.get(value, None) + if pseudo_member is None: + need_to_create = [value] + # get unaccounted for bits + _, extra_flags = _decompose(cls, value) + # timer = 10 + while extra_flags: + # timer -= 1 + bit = _high_bit(extra_flags) + flag_value = 2 ** bit + if (flag_value not in cls._value2member_map_ and + flag_value not in need_to_create + ): + need_to_create.append(flag_value) + if extra_flags == -flag_value: + extra_flags = 0 + else: + extra_flags ^= flag_value + for value in reversed(need_to_create): + # construct singleton pseudo-members + pseudo_member = int.__new__(cls, value) + pseudo_member._name_ = None + pseudo_member._value_ = value + # use setdefault in case another thread already created a composite + # with this value + pseudo_member = cls._value2member_map_.setdefault(value, pseudo_member) + return pseudo_member + + def __or__(self, other): + if not isinstance(other, (self.__class__, int)): + return NotImplemented + result = self.__class__(self._value_ | self.__class__(other)._value_) + return result + + def __and__(self, other): + if not isinstance(other, (self.__class__, int)): + return NotImplemented + return self.__class__(self._value_ & self.__class__(other)._value_) + + def __xor__(self, other): + if not isinstance(other, (self.__class__, int)): + return NotImplemented + return self.__class__(self._value_ ^ self.__class__(other)._value_) + + __ror__ = __or__ + __rand__ = __and__ + __rxor__ = __xor__ + + def __invert__(self): + result = self.__class__(~self._value_) + return result
+ + +def _high_bit(value): + """returns index of highest bit, or -1 if value is zero or negative""" + return value.bit_length() - 1 + +
[docs]def unique(enumeration): + """Class decorator for enumerations ensuring unique member values.""" + duplicates = [] + for name, member in enumeration.__members__.items(): + if name != member.name: + duplicates.append((name, member.name)) + if duplicates: + alias_details = ', '.join( + ["%s -> %s" % (alias, name) for (alias, name) in duplicates]) + raise ValueError('duplicate values found in %r: %s' % + (enumeration, alias_details)) + return enumeration
+ +def _decompose(flag, value): + """Extract all members from the value.""" + # _decompose is only called if the value is not named + not_covered = value + negative = value < 0 + # issue29167: wrap accesses to _value2member_map_ in a list to avoid race + # conditions between iterating over it and having more pseudo- + # members added to it + if negative: + # only check for named flags + flags_to_check = [ + (m, v) + for v, m in list(flag._value2member_map_.items()) + if m.name is not None + ] + else: + # check for named flags and powers-of-two flags + flags_to_check = [ + (m, v) + for v, m in list(flag._value2member_map_.items()) + if m.name is not None or _power_of_two(v) + ] + members = [] + for member, member_value in flags_to_check: + if member_value and member_value & value == member_value: + members.append(member) + not_covered &= ~member_value + if not members and value in flag._value2member_map_: + members.append(flag._value2member_map_[value]) + members.sort(key=lambda m: m._value_, reverse=True) + if len(members) > 1 and members[0].value == value: + # we have the breakdown, don't need the value member itself + members.pop(0) + return members, not_covered + +def _power_of_two(value): + if value < 1: + return False + return value == 2 ** _high_bit(value) +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/error.html b/reference/_modules/error.html new file mode 100644 index 0000000..aef905f --- /dev/null +++ b/reference/_modules/error.html @@ -0,0 +1,219 @@ + + + + + + + error — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for error

+# Copyright (C) 2015 Twitter, Inc.
+
+"""Container for all errors raised by the Twitter Ads SDK."""
+
+
+
[docs]class Error(Exception): + """The base class for all SDK error types.""" + + def __init__(self, response, **kwargs): + self._response = response + self._code = kwargs.get('code', response.code) + + if response.body and 'errors' in response.body: + self._details = kwargs.get('details', response.body.get('errors')) + else: + self._details = None + + @property + def response(self): + return self._response + + @property + def code(self): + return self._code + + @property + def details(self): + return self._details + + def __repr__(self): + return '<{name} object at {mem} code={code} details={details}>'.format( + name=self.__class__.__name__, + mem=hex(id(self)), + code=getattr(self, 'code'), + details=getattr(self, 'details') + ) + + def __str__(self): + return self.__repr__() + +
[docs] @staticmethod + def from_response(response): + """Returns the correct error type from a ::class::`Response` object.""" + if response.code: + return ERRORS[response.code](response) + else: + return Error(response)
+ + +
[docs]class ClientError(Error): + """Parent class for preventable client errors."""
+ + +
[docs]class BadRequest(ClientError): + """Bad Request (400)."""
+ + +
[docs]class NotAuthorized(ClientError): + """Not Authorized (401)."""
+ + +
[docs]class Forbidden(ClientError): + """Forbidden (403)."""
+ + +
[docs]class NotFound(ClientError): + """Forbidden (404)."""
+ + +
[docs]class RateLimit(ClientError): + """Rate Limit (429).""" + + def __init__(self, response, **kwargs): + super(RateLimit, self).__init__(response, **kwargs) + self._reset_at = response.headers.get('x-account-rate-limit-reset')\ + or response.headers.get('x-rate-limit-reset') + + @property + def reset_at(self): + return self._reset_at
+ + +
[docs]class ServerError(Error): + """Server Error (500)."""
+ + +
[docs]class ServiceUnavailable(ServerError): + """Service Unavailable (503).""" + + def __init__(self, response, **kwargs): + super(ServiceUnavailable, self).__init__(response, **kwargs) + self._retry_after = response.headers.get('retry-after', None) + + @property + def retry_after(self): + return self._retry_after
+ + +ERRORS = { + 400: BadRequest, + 401: NotAuthorized, + 403: Forbidden, + 404: NotFound, + 429: RateLimit, + 500: ServerError, + 503: ServiceUnavailable +} +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/http.html b/reference/_modules/http.html new file mode 100644 index 0000000..196166c --- /dev/null +++ b/reference/_modules/http.html @@ -0,0 +1,249 @@ + + + + + + + http — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for http

+from enum import IntEnum
+
+__all__ = ['HTTPStatus']
+
+
[docs]class HTTPStatus(IntEnum): + """HTTP status codes and reason phrases + + Status codes from the following RFCs are all observed: + + * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 + * RFC 6585: Additional HTTP Status Codes + * RFC 3229: Delta encoding in HTTP + * RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518 + * RFC 5842: Binding Extensions to WebDAV + * RFC 7238: Permanent Redirect + * RFC 2295: Transparent Content Negotiation in HTTP + * RFC 2774: An HTTP Extension Framework + * RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2) + """ + def __new__(cls, value, phrase, description=''): + obj = int.__new__(cls, value) + obj._value_ = value + + obj.phrase = phrase + obj.description = description + return obj + + # informational + CONTINUE = 100, 'Continue', 'Request received, please continue' + SWITCHING_PROTOCOLS = (101, 'Switching Protocols', + 'Switching to new protocol; obey Upgrade header') + PROCESSING = 102, 'Processing' + + # success + OK = 200, 'OK', 'Request fulfilled, document follows' + CREATED = 201, 'Created', 'Document created, URL follows' + ACCEPTED = (202, 'Accepted', + 'Request accepted, processing continues off-line') + NON_AUTHORITATIVE_INFORMATION = (203, + 'Non-Authoritative Information', 'Request fulfilled from cache') + NO_CONTENT = 204, 'No Content', 'Request fulfilled, nothing follows' + RESET_CONTENT = 205, 'Reset Content', 'Clear input form for further input' + PARTIAL_CONTENT = 206, 'Partial Content', 'Partial content follows' + MULTI_STATUS = 207, 'Multi-Status' + ALREADY_REPORTED = 208, 'Already Reported' + IM_USED = 226, 'IM Used' + + # redirection + MULTIPLE_CHOICES = (300, 'Multiple Choices', + 'Object has several resources -- see URI list') + MOVED_PERMANENTLY = (301, 'Moved Permanently', + 'Object moved permanently -- see URI list') + FOUND = 302, 'Found', 'Object moved temporarily -- see URI list' + SEE_OTHER = 303, 'See Other', 'Object moved -- see Method and URL list' + NOT_MODIFIED = (304, 'Not Modified', + 'Document has not changed since given time') + USE_PROXY = (305, 'Use Proxy', + 'You must use proxy specified in Location to access this resource') + TEMPORARY_REDIRECT = (307, 'Temporary Redirect', + 'Object moved temporarily -- see URI list') + PERMANENT_REDIRECT = (308, 'Permanent Redirect', + 'Object moved temporarily -- see URI list') + + # client error + BAD_REQUEST = (400, 'Bad Request', + 'Bad request syntax or unsupported method') + UNAUTHORIZED = (401, 'Unauthorized', + 'No permission -- see authorization schemes') + PAYMENT_REQUIRED = (402, 'Payment Required', + 'No payment -- see charging schemes') + FORBIDDEN = (403, 'Forbidden', + 'Request forbidden -- authorization will not help') + NOT_FOUND = (404, 'Not Found', + 'Nothing matches the given URI') + METHOD_NOT_ALLOWED = (405, 'Method Not Allowed', + 'Specified method is invalid for this resource') + NOT_ACCEPTABLE = (406, 'Not Acceptable', + 'URI not available in preferred format') + PROXY_AUTHENTICATION_REQUIRED = (407, + 'Proxy Authentication Required', + 'You must authenticate with this proxy before proceeding') + REQUEST_TIMEOUT = (408, 'Request Timeout', + 'Request timed out; try again later') + CONFLICT = 409, 'Conflict', 'Request conflict' + GONE = (410, 'Gone', + 'URI no longer exists and has been permanently removed') + LENGTH_REQUIRED = (411, 'Length Required', + 'Client must specify Content-Length') + PRECONDITION_FAILED = (412, 'Precondition Failed', + 'Precondition in headers is false') + REQUEST_ENTITY_TOO_LARGE = (413, 'Request Entity Too Large', + 'Entity is too large') + REQUEST_URI_TOO_LONG = (414, 'Request-URI Too Long', + 'URI is too long') + UNSUPPORTED_MEDIA_TYPE = (415, 'Unsupported Media Type', + 'Entity body in unsupported format') + REQUESTED_RANGE_NOT_SATISFIABLE = (416, + 'Requested Range Not Satisfiable', + 'Cannot satisfy request range') + EXPECTATION_FAILED = (417, 'Expectation Failed', + 'Expect condition could not be satisfied') + MISDIRECTED_REQUEST = (421, 'Misdirected Request', + 'Server is not able to produce a response') + UNPROCESSABLE_ENTITY = 422, 'Unprocessable Entity' + LOCKED = 423, 'Locked' + FAILED_DEPENDENCY = 424, 'Failed Dependency' + UPGRADE_REQUIRED = 426, 'Upgrade Required' + PRECONDITION_REQUIRED = (428, 'Precondition Required', + 'The origin server requires the request to be conditional') + TOO_MANY_REQUESTS = (429, 'Too Many Requests', + 'The user has sent too many requests in ' + 'a given amount of time ("rate limiting")') + REQUEST_HEADER_FIELDS_TOO_LARGE = (431, + 'Request Header Fields Too Large', + 'The server is unwilling to process the request because its header ' + 'fields are too large') + + # server errors + INTERNAL_SERVER_ERROR = (500, 'Internal Server Error', + 'Server got itself in trouble') + NOT_IMPLEMENTED = (501, 'Not Implemented', + 'Server does not support this operation') + BAD_GATEWAY = (502, 'Bad Gateway', + 'Invalid responses from another server/proxy') + SERVICE_UNAVAILABLE = (503, 'Service Unavailable', + 'The server cannot process the request due to a high load') + GATEWAY_TIMEOUT = (504, 'Gateway Timeout', + 'The gateway server did not receive a timely response') + HTTP_VERSION_NOT_SUPPORTED = (505, 'HTTP Version Not Supported', + 'Cannot fulfill request') + VARIANT_ALSO_NEGOTIATES = 506, 'Variant Also Negotiates' + INSUFFICIENT_STORAGE = 507, 'Insufficient Storage' + LOOP_DETECTED = 508, 'Loop Detected' + NOT_EXTENDED = 510, 'Not Extended' + NETWORK_AUTHENTICATION_REQUIRED = (511, + 'Network Authentication Required', + 'The client needs to authenticate to gain network access')
+
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/index.html b/reference/_modules/index.html new file mode 100644 index 0000000..9018b35 --- /dev/null +++ b/reference/_modules/index.html @@ -0,0 +1,121 @@ + + + + + + + Overview: module code — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

All modules for which code is available

+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/resource.html b/reference/_modules/resource.html new file mode 100644 index 0000000..9e22852 --- /dev/null +++ b/reference/_modules/resource.html @@ -0,0 +1,476 @@ + + + + + + + resource — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for resource

+# Copyright (C) 2015 Twitter, Inc.
+
+"""Container for all plugable resource object logic used by the Ads API SDK."""
+
+import dateutil.parser
+from datetime import datetime, timedelta
+try:
+    from urllib.parse import urlparse
+except ImportError:
+    from urlparse import urlparse
+import json
+
+from twitter_ads.utils import format_time, to_time, validate_whole_hours
+from twitter_ads.enum import ENTITY, GRANULARITY, PLACEMENT, TRANSFORM
+from twitter_ads.http import Request
+from twitter_ads.cursor import Cursor
+from twitter_ads import API_VERSION
+from twitter_ads.utils import extract_response_headers, FlattenParams
+
+
+
[docs]def resource_property(klass, name, **kwargs): + """Builds a resource object property.""" + klass.PROPERTIES[name] = kwargs + + def getter(self): + return getattr(self, '_%s' % name, kwargs.get('default', None)) + + if kwargs.get('readonly', False): + setattr(klass, name, property(getter)) + else: + def setter(self, value): + setattr(self, '_%s' % name, value) + setattr(klass, name, property(getter, setter))
+ + +
[docs]class Resource(object): + """Base class for all API resource objects.""" + + def __init__(self, account): + self._account = account + + @property + def account(self): + return self._account + +
[docs] def from_response(self, response, headers=None): + """ + Populates a given objects attributes from a parsed JSON API response. + This helper handles all necessary type coercions as it assigns + attribute values. + """ + if headers is not None: + limits = extract_response_headers(headers) + for k in limits: + setattr(self, k, limits[k]) + + for name in self.PROPERTIES: + attr = '_{0}'.format(name) + transform = self.PROPERTIES[name].get('transform', None) + value = response.get(name, None) + if transform and transform == TRANSFORM.TIME and value: + setattr(self, attr, dateutil.parser.parse(value)) + if isinstance(value, int) and value == 0: + continue # skip attribute + else: + setattr(self, attr, value) + + return self
+ +
[docs] def to_params(self): + """ + Generates a Hash of property values for the current object. This helper + handles all necessary type coercions as it generates its output. + """ + params = {} + for name in self.PROPERTIES: + attr = '_{0}'.format(name) + value = getattr(self, attr, None) or getattr(self, name, None) + + # skip attribute + if value is None: + continue + + if isinstance(value, datetime): + params[name] = format_time(value) + elif isinstance(value, list): + params[name] = ','.join(map(str, value)) + elif isinstance(value, bool): + params[name] = str(value).lower() + else: + params[name] = value + + return params
+ +
[docs] @classmethod + def all(klass, account, **kwargs): + """Returns a Cursor instance for a given resource.""" + resource = klass.RESOURCE_COLLECTION.format(account_id=account.id) + request = Request(account.client, 'get', resource, params=kwargs) + return Cursor(klass, request, init_with=[account])
+ +
[docs] @classmethod + def load(klass, account, id, **kwargs): + """Returns an object instance for a given resource.""" + resource = klass.RESOURCE.format(account_id=account.id, id=id) + response = Request(account.client, 'get', resource, params=kwargs).perform() + + return klass(account).from_response(response.body['data'])
+ +
[docs] def reload(self, **kwargs): + """ + Reloads all attributes for the current object instance from the API. + """ + if not self.id: + return self + + resource = self.RESOURCE.format(account_id=self.account.id, id=self.id) + response = Request(self.account.client, 'get', resource, params=kwargs).perform() + + return self.from_response(response.body['data'])
+ + def __repr__(self): + return '<{name} resource at {mem} id={id}>'.format( + name=self.__class__.__name__, + mem=hex(id(self)), + id=getattr(self, 'id', None) + ) + + def _validate_loaded(self): + if not self.id: + raise ValueError(""" + Error! {klass} object not yet initialized, + call {klass}.load first. + """).format(klass=self.__class__) + + def _load_resource(self, klass, id, **kwargs): + self._validate_loaded() + if id is None: + return klass.all(self, **kwargs) + else: + return klass.load(self, id, **kwargs)
+ + +class Batch(object): + + _ENTITY_MAP = { + 'LineItem': ENTITY.LINE_ITEM, + 'Campaign': ENTITY.CAMPAIGN, + 'TargetingCriteria': ENTITY.TARGETING_CRITERION + } + + @classmethod + def batch_save(klass, account, objs): + """ + Makes batch request(s) for a passed in list of objects + """ + + resource = klass.BATCH_RESOURCE_COLLECTION.format(account_id=account.id) + + json_body = [] + + for obj in objs: + entity_type = klass._ENTITY_MAP[klass.__name__].lower() + obj_json = {'params': obj.to_params()} + + if obj.id is None: + obj_json['operation_type'] = 'Create' + elif obj.to_delete is True: + obj_json['operation_type'] = 'Delete' + obj_json['params'][entity_type + '_id'] = obj.id + else: + obj_json['operation_type'] = 'Update' + obj_json['params'][entity_type + '_id'] = obj.id + + json_body.append(obj_json) + + resource = klass.BATCH_RESOURCE_COLLECTION.format(account_id=account.id) + response = Request(account.client, + 'post', resource, + body=json.dumps(json_body), + headers={'Content-Type': 'application/json'}).perform() + + # persist each entity + for obj, res_obj in zip(objs, response.body['data']): + obj = obj.from_response(res_obj) + + +
[docs]class Persistence(object): + """ + Container for all persistence related logic used by API resource objects. + """ + +
[docs] def save(self): + """ + Saves or updates the current object instance depending on the + presence of `object.id`. + """ + if self.id: + method = 'put' + resource = self.RESOURCE.format(account_id=self.account.id, id=self.id) + else: + method = 'post' + resource = self.RESOURCE_COLLECTION.format(account_id=self.account.id) + + response = Request( + self.account.client, method, + resource, params=self.to_params()).perform() + + return self.from_response(response.body['data'])
+ +
[docs] def delete(self): + """ + Deletes the current object instance depending on the + presence of `object.id`. + """ + resource = self.RESOURCE.format(account_id=self.account.id, id=self.id) + response = Request(self.account.client, 'delete', resource).perform() + self.from_response(response.body['data'])
+ + +
[docs]class Analytics(Resource): + """ + Container for all analytics related logic used by API resource objects. + """ + PROPERTIES = {} + + ANALYTICS_MAP = { + 'Campaign': ENTITY.CAMPAIGN, + 'FundingInstrument': ENTITY.FUNDING_INSTRUMENT, + 'LineItem': ENTITY.LINE_ITEM, + 'MediaCreative': ENTITY.MEDIA_CREATIVE, + 'OrganicTweet': ENTITY.ORGANIC_TWEET, + 'PromotedTweet': ENTITY.PROMOTED_TWEET, + 'PromotedAccount': ENTITY.PROMOTED_ACCOUNT + } + + RESOURCE_SYNC = '/' + API_VERSION + '/stats/accounts/{account_id}' + RESOURCE_ASYNC = '/' + API_VERSION + '/stats/jobs/accounts/{account_id}' + RESOURCE_ACTIVE_ENTITIES = '/' + API_VERSION + '/stats/accounts/{account_id}/active_entities' + +
[docs] def stats(self, metrics, **kwargs): # noqa + """ + Pulls a list of metrics for the current object instance. + """ + return self.__class__.all_stats(self.account, [self.id], metrics, **kwargs)
+ + @classmethod + def _standard_params(klass, ids, metric_groups, **kwargs): + """ + Sets the standard params for a stats request + """ + end_time = kwargs.get('end_time', datetime.utcnow()) + start_time = kwargs.get('start_time', end_time - timedelta(seconds=604800)) + granularity = kwargs.get('granularity', GRANULARITY.HOUR) + placement = kwargs.get('placement', PLACEMENT.ALL_ON_TWITTER) + entity = kwargs.get('entity', None) + + params = { + 'metric_groups': ','.join(map(str, metric_groups)), + 'start_time': to_time(start_time, granularity), + 'end_time': to_time(end_time, granularity), + 'granularity': granularity.upper(), + 'entity': entity or klass.ANALYTICS_MAP[klass.__name__], + 'placement': placement + } + + params['entity_ids'] = ','.join(map(str, ids)) + + return params + +
[docs] @classmethod + def all_stats(klass, account, ids, metric_groups, **kwargs): + """ + Pulls a list of metrics for a specified set of object IDs. + """ + params = klass._standard_params(ids, metric_groups, **kwargs) + + resource = klass.RESOURCE_SYNC.format(account_id=account.id) + response = Request(account.client, 'get', resource, params=params).perform() + return response.body['data']
+ +
[docs] @classmethod + def queue_async_stats_job(klass, account, ids, metric_groups, **kwargs): + """ + Queues a list of metrics for a specified set of object IDs asynchronously + """ + params = klass._standard_params(ids, metric_groups, **kwargs) + + params['platform'] = kwargs.get('platform', None) + params['country'] = kwargs.get('country', None) + params['segmentation_type'] = kwargs.get('segmentation_type', None) + + resource = klass.RESOURCE_ASYNC.format(account_id=account.id) + response = Request(account.client, 'post', resource, params=params).perform() + return Analytics(account).from_response(response.body['data'], headers=response.headers)
+ + @classmethod + @FlattenParams + def async_stats_job_result(klass, account, **kwargs): + """ + Returns the results of the specified async job IDs + """ + resource = klass.RESOURCE_ASYNC.format(account_id=account.id) + request = Request(account.client, 'get', resource, params=kwargs) + + return Cursor(Analytics, request, init_with=[account]) + +
[docs] @classmethod + def async_stats_job_data(klass, account, url, **kwargs): + """ + Returns the results of the specified async job IDs + """ + resource = urlparse(url) + domain = '{0}://{1}'.format(resource.scheme, resource.netloc) + + response = Request(account.client, 'get', resource.path, domain=domain, + raw_body=True, stream=True).perform() + + return response.body
+ + @classmethod + @FlattenParams + def active_entities(klass, account, start_time, end_time, **kwargs): + """ + Returns the details about which entities' analytics metrics + have changed in a given time period. + """ + entity = kwargs.get('entity') or klass.ANALYTICS_MAP[klass.__name__] + if entity == klass.ANALYTICS_MAP['OrganicTweet']: + raise ValueError("'OrganicTweet' not support with 'active_entities'") + + # The start and end times must be expressed in whole hours + validate_whole_hours(start_time) + validate_whole_hours(end_time) + + params = { + 'entity': entity, + 'start_time': to_time(start_time, None), + 'end_time': to_time(end_time, None) + } + params.update(kwargs) + + resource = klass.RESOURCE_ACTIVE_ENTITIES.format(account_id=account.id) + response = Request(account.client, 'get', resource, params=params).perform() + return response.body['data']
+ + +# Analytics properties +# read-only +resource_property(Analytics, 'id', readonly=True) +resource_property(Analytics, 'id_str', readonly=True) +resource_property(Analytics, 'status', readonly=True) +resource_property(Analytics, 'url', readonly=True) +resource_property(Analytics, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(Analytics, 'expires_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(Analytics, 'updated_at', readonly=True, transform=TRANSFORM.TIME) + +resource_property(Analytics, 'start_time', readonly=True, transform=TRANSFORM.TIME) +resource_property(Analytics, 'end_time', readonly=True, transform=TRANSFORM.TIME) +resource_property(Analytics, 'entity', readonly=True) +resource_property(Analytics, 'entity_ids', readonly=True) +resource_property(Analytics, 'placement', readonly=True) +resource_property(Analytics, 'granularity', readonly=True) +resource_property(Analytics, 'metric_groups', readonly=True) +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/_modules/utils.html b/reference/_modules/utils.html new file mode 100644 index 0000000..4d543d3 --- /dev/null +++ b/reference/_modules/utils.html @@ -0,0 +1,230 @@ + + + + + + + utils — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for utils

+# Copyright (C) 2015 Twitter, Inc.
+from __future__ import division
+
+"""Container for all helpers and utilities used throughout the Ads API SDK."""
+
+import datetime
+import re
+import warnings
+warnings.simplefilter('default', DeprecationWarning)
+from email.utils import formatdate
+from time import mktime
+
+from twitter_ads import VERSION
+from twitter_ads.enum import GRANULARITY
+
+
+
[docs]def get_version(): + """Returns a string representation of the current SDK version.""" + if isinstance(VERSION[-1], str): + return '.'.join(map(str, VERSION[:-1])) + VERSION[-1] + return '.'.join(map(str, VERSION))
+ + +
[docs]def remove_minutes(time): + """Sets the minutes, seconds, and microseconds to zero.""" + return time.replace(minute=0, second=0, microsecond=0)
+ + +
[docs]def remove_hours(time): + """Sets the hours, minutes, seconds, and microseconds to zero.""" + return time.replace(hour=0, minute=0, second=0, microsecond=0)
+ + +
[docs]def to_time(time, granularity): + """Returns a truncated and rounded time string based on the specified granularity.""" + if not granularity: + if type(time) is datetime.date: + return format_date(time) + else: + return format_time(time) + if granularity == GRANULARITY.HOUR: + return format_time(remove_minutes(time)) + elif granularity == GRANULARITY.DAY: + return format_date(remove_hours(time)) + else: + return format_time(time)
+ + +
[docs]def format_time(time): + """Formats a datetime as an ISO 8601 compliant string.""" + return time.strftime('%Y-%m-%dT%H:%M:%SZ')
+ + +
[docs]def format_date(time): + """Formats a datetime as an ISO 8601 compliant string, dropping time.""" + return time.strftime('%Y-%m-%d')
+ + +
[docs]def http_time(time): + """Formats a datetime as an RFC 1123 compliant string.""" + return formatdate(timeval=mktime(time.timetuple()), localtime=False, usegmt=True)
+ + +def validate_whole_hours(time): + if type(time) is datetime.date: + pass + else: + # Times must be expressed in whole hours + if time.minute > 0 or time.second > 0: + raise ValueError("'start_time' and 'end_time' must be expressed in whole hours.") + + +def extract_response_headers(headers): + values = {} + # only get "X-${name}" custom response headers + reg = re.compile(r"^x-", re.IGNORECASE) + for i in headers: + if reg.match(i): + values[i.lstrip('x-').replace('-', '_')] = headers[i] + + return values + + +
[docs]def split_list(list_, n): + """Splits a list by a given number (n) and returns a generator object.""" + list_size = len(list_) + for sp in range(0, list_size, n): + yield list_[sp:min(sp + n, list_size)]
+ + +class Deprecated(object): + def __init__(self, message): + self._message = message + + def __call__(self, decorated, *args, **kwargs): + def wrapper(*args, **kwargs): + method = "{}.{}".format(str(args[0].__name__), str(decorated.__name__)) + warnings.warn( + "{} => {}".format(method, self._message), + DeprecationWarning, + stacklevel=2 + ) + return decorated(*args, **kwargs) + return wrapper + + +class FlattenParams(object): + def __init__(self, function): + self._func = function + + def __call__(self, *args, **kwargs): + params = kwargs + for i in params: + if isinstance(params[i], list): + params[i] = ','.join(map(str, params[i])) + elif isinstance(params[i], bool): + params[i] = str(params[i]).lower() + return self._func(*args, **params) +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/source/index.rst b/reference/_sources/index.rst.txt similarity index 100% rename from docs/source/index.rst rename to reference/_sources/index.rst.txt diff --git a/docs/source/twitter_ads/account.rst b/reference/_sources/twitter_ads/account.rst.txt similarity index 100% rename from docs/source/twitter_ads/account.rst rename to reference/_sources/twitter_ads/account.rst.txt diff --git a/docs/source/twitter_ads/audience.rst b/reference/_sources/twitter_ads/audience.rst.txt similarity index 100% rename from docs/source/twitter_ads/audience.rst rename to reference/_sources/twitter_ads/audience.rst.txt diff --git a/docs/source/twitter_ads/campaign.rst b/reference/_sources/twitter_ads/campaign.rst.txt similarity index 100% rename from docs/source/twitter_ads/campaign.rst rename to reference/_sources/twitter_ads/campaign.rst.txt diff --git a/docs/source/twitter_ads/client.rst b/reference/_sources/twitter_ads/client.rst.txt similarity index 100% rename from docs/source/twitter_ads/client.rst rename to reference/_sources/twitter_ads/client.rst.txt diff --git a/docs/source/twitter_ads/creative.rst b/reference/_sources/twitter_ads/creative.rst.txt similarity index 100% rename from docs/source/twitter_ads/creative.rst rename to reference/_sources/twitter_ads/creative.rst.txt diff --git a/docs/source/twitter_ads/cursor.rst b/reference/_sources/twitter_ads/cursor.rst.txt similarity index 100% rename from docs/source/twitter_ads/cursor.rst rename to reference/_sources/twitter_ads/cursor.rst.txt diff --git a/docs/source/twitter_ads/enum.rst b/reference/_sources/twitter_ads/enum.rst.txt similarity index 100% rename from docs/source/twitter_ads/enum.rst rename to reference/_sources/twitter_ads/enum.rst.txt diff --git a/docs/source/twitter_ads/error.rst b/reference/_sources/twitter_ads/error.rst.txt similarity index 100% rename from docs/source/twitter_ads/error.rst rename to reference/_sources/twitter_ads/error.rst.txt diff --git a/docs/source/twitter_ads/http.rst b/reference/_sources/twitter_ads/http.rst.txt similarity index 100% rename from docs/source/twitter_ads/http.rst rename to reference/_sources/twitter_ads/http.rst.txt diff --git a/docs/source/twitter_ads/index.rst b/reference/_sources/twitter_ads/index.rst.txt similarity index 100% rename from docs/source/twitter_ads/index.rst rename to reference/_sources/twitter_ads/index.rst.txt diff --git a/docs/source/twitter_ads/resource.rst b/reference/_sources/twitter_ads/resource.rst.txt similarity index 100% rename from docs/source/twitter_ads/resource.rst rename to reference/_sources/twitter_ads/resource.rst.txt diff --git a/docs/source/twitter_ads/targeting.rst b/reference/_sources/twitter_ads/targeting.rst.txt similarity index 100% rename from docs/source/twitter_ads/targeting.rst rename to reference/_sources/twitter_ads/targeting.rst.txt diff --git a/docs/source/twitter_ads/utils.rst b/reference/_sources/twitter_ads/utils.rst.txt similarity index 100% rename from docs/source/twitter_ads/utils.rst rename to reference/_sources/twitter_ads/utils.rst.txt diff --git a/reference/_static/alabaster.css b/reference/_static/alabaster.css new file mode 100644 index 0000000..0eddaeb --- /dev/null +++ b/reference/_static/alabaster.css @@ -0,0 +1,701 @@ +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +body { + font-family: Georgia, serif; + font-size: 17px; + background-color: #fff; + color: #000; + margin: 0; + padding: 0; +} + + +div.document { + width: 940px; + margin: 30px auto 0 auto; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 220px; +} + +div.sphinxsidebar { + width: 220px; + font-size: 14px; + line-height: 1.5; +} + +hr { + border: 1px solid #B1B4B6; +} + +div.body { + background-color: #fff; + color: #3E4349; + padding: 0 30px 0 30px; +} + +div.body > .section { + text-align: left; +} + +div.footer { + width: 940px; + margin: 20px auto 30px auto; + font-size: 14px; + color: #888; + text-align: right; +} + +div.footer a { + color: #888; +} + +p.caption { + font-family: inherit; + font-size: inherit; +} + + +div.relations { + display: none; +} + + +div.sphinxsidebar a { + color: #444; + text-decoration: none; + border-bottom: 1px dotted #999; +} + +div.sphinxsidebar a:hover { + border-bottom: 1px solid #999; +} + +div.sphinxsidebarwrapper { + padding: 18px 10px; +} + +div.sphinxsidebarwrapper p.logo { + padding: 0; + margin: -10px 0 0 0px; + text-align: center; +} + +div.sphinxsidebarwrapper h1.logo { + margin-top: -10px; + text-align: center; + margin-bottom: 5px; + text-align: left; +} + +div.sphinxsidebarwrapper h1.logo-name { + margin-top: 0px; +} + +div.sphinxsidebarwrapper p.blurb { + margin-top: 0; + font-style: normal; +} + +div.sphinxsidebar h3, +div.sphinxsidebar h4 { + font-family: Georgia, serif; + color: #444; + font-size: 24px; + font-weight: normal; + margin: 0 0 5px 0; + padding: 0; +} + +div.sphinxsidebar h4 { + font-size: 20px; +} + +div.sphinxsidebar h3 a { + color: #444; +} + +div.sphinxsidebar p.logo a, +div.sphinxsidebar h3 a, +div.sphinxsidebar p.logo a:hover, +div.sphinxsidebar h3 a:hover { + border: none; +} + +div.sphinxsidebar p { + color: #555; + margin: 10px 0; +} + +div.sphinxsidebar ul { + margin: 10px 0; + padding: 0; + color: #000; +} + +div.sphinxsidebar ul li.toctree-l1 > a { + font-size: 120%; +} + +div.sphinxsidebar ul li.toctree-l2 > a { + font-size: 110%; +} + +div.sphinxsidebar input { + border: 1px solid #CCC; + font-family: Georgia, serif; + font-size: 1em; +} + +div.sphinxsidebar hr { + border: none; + height: 1px; + color: #AAA; + background: #AAA; + + text-align: left; + margin-left: 0; + width: 50%; +} + +div.sphinxsidebar .badge { + border-bottom: none; +} + +div.sphinxsidebar .badge:hover { + border-bottom: none; +} + +/* To address an issue with donation coming after search */ +div.sphinxsidebar h3.donation { + margin-top: 10px; +} + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: #004B6B; + text-decoration: underline; +} + +a:hover { + color: #6D4100; + text-decoration: underline; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: Georgia, serif; + font-weight: normal; + margin: 30px 0px 10px 0px; + padding: 0; +} + +div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } +div.body h2 { font-size: 180%; } +div.body h3 { font-size: 150%; } +div.body h4 { font-size: 130%; } +div.body h5 { font-size: 100%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: #DDD; + padding: 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + color: #444; + background: #EAEAEA; +} + +div.body p, div.body dd, div.body li { + line-height: 1.4em; +} + +div.admonition { + margin: 20px 0px; + padding: 10px 30px; + background-color: #EEE; + border: 1px solid #CCC; +} + +div.admonition tt.xref, div.admonition code.xref, div.admonition a tt { + background-color: #FBFBFB; + border-bottom: 1px solid #fafafa; +} + +div.admonition p.admonition-title { + font-family: Georgia, serif; + font-weight: normal; + font-size: 24px; + margin: 0 0 10px 0; + padding: 0; + line-height: 1; +} + +div.admonition p.last { + margin-bottom: 0; +} + +div.highlight { + background-color: #fff; +} + +dt:target, .highlight { + background: #FAF3E8; +} + +div.warning { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.danger { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.error { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.caution { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.attention { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.important { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.note { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.tip { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.hint { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.seealso { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.topic { + background-color: #EEE; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre, tt, code { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; + font-size: 0.9em; +} + +.hll { + background-color: #FFC; + margin: 0 -12px; + padding: 0 12px; + display: block; +} + +img.screenshot { +} + +tt.descname, tt.descclassname, code.descname, code.descclassname { + font-size: 0.95em; +} + +tt.descname, code.descname { + padding-right: 0.08em; +} + +img.screenshot { + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils { + border: 1px solid #888; + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils td, table.docutils th { + border: 1px solid #888; + padding: 0.25em 0.7em; +} + +table.field-list, table.footnote { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +table.footnote { + margin: 15px 0; + width: 100%; + border: 1px solid #EEE; + background: #FDFDFD; + font-size: 0.9em; +} + +table.footnote + table.footnote { + margin-top: -15px; + border-top: none; +} + +table.field-list th { + padding: 0 0.8em 0 0; +} + +table.field-list td { + padding: 0; +} + +table.field-list p { + margin-bottom: 0.8em; +} + +/* Cloned from + * https://github.com/sphinx-doc/sphinx/commit/ef60dbfce09286b20b7385333d63a60321784e68 + */ +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +table.footnote td.label { + width: .1px; + padding: 0.3em 0 0.3em 0.5em; +} + +table.footnote td { + padding: 0.3em 0.5em; +} + +dl { + margin: 0; + padding: 0; +} + +dl dd { + margin-left: 30px; +} + +blockquote { + margin: 0 0 0 30px; + padding: 0; +} + +ul, ol { + /* Matches the 30px from the narrow-screen "li > ul" selector below */ + margin: 10px 0 10px 30px; + padding: 0; +} + +pre { + background: #EEE; + padding: 7px 30px; + margin: 15px 0px; + line-height: 1.3em; +} + +div.viewcode-block:target { + background: #ffd; +} + +dl pre, blockquote pre, li pre { + margin-left: 0; + padding-left: 30px; +} + +tt, code { + background-color: #ecf0f3; + color: #222; + /* padding: 1px 2px; */ +} + +tt.xref, code.xref, a tt { + background-color: #FBFBFB; + border-bottom: 1px solid #fff; +} + +a.reference { + text-decoration: none; + border-bottom: 1px dotted #004B6B; +} + +/* Don't put an underline on images */ +a.image-reference, a.image-reference:hover { + border-bottom: none; +} + +a.reference:hover { + border-bottom: 1px solid #6D4100; +} + +a.footnote-reference { + text-decoration: none; + font-size: 0.7em; + vertical-align: top; + border-bottom: 1px dotted #004B6B; +} + +a.footnote-reference:hover { + border-bottom: 1px solid #6D4100; +} + +a:hover tt, a:hover code { + background: #EEE; +} + + +@media screen and (max-width: 870px) { + + div.sphinxsidebar { + display: none; + } + + div.document { + width: 100%; + + } + + div.documentwrapper { + margin-left: 0; + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + } + + div.bodywrapper { + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + margin-left: 0; + } + + ul { + margin-left: 0; + } + + li > ul { + /* Matches the 30px from the "ul, ol" selector above */ + margin-left: 30px; + } + + .document { + width: auto; + } + + .footer { + width: auto; + } + + .bodywrapper { + margin: 0; + } + + .footer { + width: auto; + } + + .github { + display: none; + } + + + +} + + + +@media screen and (max-width: 875px) { + + body { + margin: 0; + padding: 20px 30px; + } + + div.documentwrapper { + float: none; + background: #fff; + } + + div.sphinxsidebar { + display: block; + float: none; + width: 102.5%; + margin: 50px -30px -20px -30px; + padding: 10px 20px; + background: #333; + color: #FFF; + } + + div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, + div.sphinxsidebar h3 a { + color: #fff; + } + + div.sphinxsidebar a { + color: #AAA; + } + + div.sphinxsidebar p.logo { + display: none; + } + + div.document { + width: 100%; + margin: 0; + } + + div.footer { + display: none; + } + + div.bodywrapper { + margin: 0; + } + + div.body { + min-height: 0; + padding: 0; + } + + .rtd_doc_footer { + display: none; + } + + .document { + width: auto; + } + + .footer { + width: auto; + } + + .footer { + width: auto; + } + + .github { + display: none; + } +} + + +/* misc. */ + +.revsys-inline { + display: none!important; +} + +/* Make nested-list/multi-paragraph items look better in Releases changelog + * pages. Without this, docutils' magical list fuckery causes inconsistent + * formatting between different release sub-lists. + */ +div#changelog > div.section > ul > li > p:only-child { + margin-bottom: 0; +} + +/* Hide fugly table cell borders in ..bibliography:: directive output */ +table.docutils.citation, table.docutils.citation td, table.docutils.citation th { + border: none; + /* Below needed in some edge cases; if not applied, bottom shadows appear */ + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + + +/* relbar */ + +.related { + line-height: 30px; + width: 100%; + font-size: 0.9rem; +} + +.related.top { + border-bottom: 1px solid #EEE; + margin-bottom: 20px; +} + +.related.bottom { + border-top: 1px solid #EEE; +} + +.related ul { + padding: 0; + margin: 0; + list-style: none; +} + +.related li { + display: inline; +} + +nav#rellinks { + float: right; +} + +nav#rellinks li+li:before { + content: "|"; +} + +nav#breadcrumbs li+li:before { + content: "\00BB"; +} + +/* Hide certain items when printing */ +@media print { + div.related { + display: none; + } +} \ No newline at end of file diff --git a/reference/_static/basic.css b/reference/_static/basic.css new file mode 100644 index 0000000..c41d718 --- /dev/null +++ b/reference/_static/basic.css @@ -0,0 +1,763 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 450px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +a.brackets:before, +span.brackets > a:before{ + content: "["; +} + +a.brackets:after, +span.brackets > a:after { + content: "]"; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > p:first-child, +td > p:first-child { + margin-top: 0px; +} + +th > p:last-child, +td > p:last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist td { + vertical-align: top; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +li > p:first-child { + margin-top: 0px; +} + +li > p:last-child { + margin-bottom: 0px; +} + +dl.footnote > dt, +dl.citation > dt { + float: left; +} + +dl.footnote > dd, +dl.citation > dd { + margin-bottom: 0em; +} + +dl.footnote > dd:after, +dl.citation > dd:after { + content: ""; + clear: both; +} + +dl.field-list { + display: flex; + flex-wrap: wrap; +} + +dl.field-list > dt { + flex-basis: 20%; + font-weight: bold; + word-break: break-word; +} + +dl.field-list > dt:after { + content: ":"; +} + +dl.field-list > dd { + flex-basis: 70%; + padding-left: 1em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > p:first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0.5em; + content: ":"; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +div.code-block-caption { + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +div.code-block-caption + div > div.highlight > pre { + margin-top: 0; +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + padding: 1em 1em 0; +} + +div.literal-block-wrapper div.highlight { + margin: 0; +} + +code.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +code.descclassname { + background-color: transparent; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: relative; + left: 0px; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/reference/_static/custom.css b/reference/_static/custom.css new file mode 100644 index 0000000..2a924f1 --- /dev/null +++ b/reference/_static/custom.css @@ -0,0 +1 @@ +/* This file intentionally left blank. */ diff --git a/reference/_static/doctools.js b/reference/_static/doctools.js new file mode 100644 index 0000000..b33f87f --- /dev/null +++ b/reference/_static/doctools.js @@ -0,0 +1,314 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for all documentation. + * + * :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); + +/** + * make the code below compatible with browsers without + * an installed firebug like debugger +if (!window.console || !console.firebug) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +} + */ + +/** + * small helper function to urldecode strings + */ +jQuery.urldecode = function(x) { + return decodeURIComponent(x).replace(/\+/g, ' '); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s === 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node, addItems) { + if (node.nodeType === 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && + !jQuery(node.parentNode).hasClass(className) && + !jQuery(node.parentNode).hasClass("nohighlight")) { + var span; + var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.className = className; + } + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + if (isInSVG) { + var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); + var bbox = node.parentElement.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute('class', className); + addItems.push({ + "parent": node.parentNode, + "target": rect}); + } + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this, addItems); + }); + } + } + var addItems = []; + var result = this.each(function() { + highlight(this, addItems); + }); + for (var i = 0; i < addItems.length; ++i) { + jQuery(addItems[i].parent).before(addItems[i].target); + } + return result; +}; + +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} + +/** + * Small JavaScript module for the documentation. + */ +var Documentation = { + + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); + if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) { + this.initOnKeyListeners(); + } + }, + + /** + * i18n support + */ + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; }, + LOCALE : 'unknown', + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated === 'undefined') + return string; + return (typeof translated === 'string') ? translated : translated[0]; + }, + + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated === 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, + + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, + + /** + * add context elements like header anchor links + */ + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, + + /** + * workaround a firefox stupidity + * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 + */ + fixFirefoxAnchorBug : function() { + if (document.location.hash && $.browser.mozilla) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, + + /** + * highlight the search words provided in the url in the text + */ + highlightSearchWords : function() { + var params = $.getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) { + var body = $('div.body'); + if (!body.length) { + body = $('body'); + } + window.setTimeout(function() { + $.each(terms, function() { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + $('') + .appendTo($('#searchbox')); + } + }, + + /** + * init the domain index toggle buttons + */ + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) === 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords : function() { + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, + + /** + * make the url absolute + */ + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, + + /** + * get the current relative url + */ + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this === '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, + + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } + } + }); + } +}; + +// quick alias for translations +_ = Documentation.gettext; + +$(document).ready(function() { + Documentation.init(); +}); diff --git a/reference/_static/documentation_options.js b/reference/_static/documentation_options.js new file mode 100644 index 0000000..623e763 --- /dev/null +++ b/reference/_static/documentation_options.js @@ -0,0 +1,10 @@ +var DOCUMENTATION_OPTIONS = { + URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), + VERSION: '6.0.0', + LANGUAGE: 'None', + COLLAPSE_INDEX: false, + FILE_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: false +}; \ No newline at end of file diff --git a/reference/_static/file.png b/reference/_static/file.png new file mode 100644 index 0000000..a858a41 Binary files /dev/null and b/reference/_static/file.png differ diff --git a/reference/_static/jquery-3.2.1.js b/reference/_static/jquery-3.2.1.js new file mode 100644 index 0000000..d2d8ca4 --- /dev/null +++ b/reference/_static/jquery-3.2.1.js @@ -0,0 +1,10253 @@ +/*! + * jQuery JavaScript Library v3.2.1 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright JS Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2017-03-20T18:59Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var document = window.document; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + + + + function DOMEval( code, doc ) { + doc = doc || document; + + var script = doc.createElement( "script" ); + + script.text = code; + doc.head.appendChild( script ).parentNode.removeChild( script ); + } +/* global Symbol */ +// Defining this global in .eslintrc.json would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var + version = "3.2.1", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android <=4.0 only + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + + // Return all the elements in a clean array + if ( num == null ) { + return slice.call( this ); + } + + // Return just the one element from the set + return num < 0 ? this[ num + this.length ] : this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = Array.isArray( copy ) ) ) ) { + + if ( copyIsArray ) { + copyIsArray = false; + clone = src && Array.isArray( src ) ? src : []; + + } else { + clone = src && jQuery.isPlainObject( src ) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isFunction: function( obj ) { + return jQuery.type( obj ) === "function"; + }, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); + }, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + + /* eslint-disable no-unused-vars */ + // See https://github.com/eslint/eslint/issues/6125 + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + DOMEval( code ); + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE <=9 - 11, Edge 12 - 13 + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // Support: Android <=4.0 only + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), +function( i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +} ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.3.3 + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2016-08-08 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf as it's faster than native + // https://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }, + + disabledAncestor = addCombinator( + function( elem ) { + return elem.disabled === true && ("form" in elem || "label" in elem); + }, + { dir: "parentNode", next: "legend" } + ); + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { + + // ID selector + if ( (m = match[1]) ) { + + // Document context + if ( nodeType === 9 ) { + if ( (elem = context.getElementById( m )) ) { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( newContext && (elem = newContext.getElementById( m )) && + contains( context, elem ) && + elem.id === m ) { + + results.push( elem ); + return results; + } + } + + // Type selector + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( (m = match[3]) && support.getElementsByClassName && + context.getElementsByClassName ) { + + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( support.qsa && + !compilerCache[ selector + " " ] && + (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + + if ( nodeType !== 1 ) { + newContext = context; + newSelector = selector; + + // qSA looks outside Element context, which is not what we want + // Thanks to Andrew Dupont for this workaround technique + // Support: IE <=8 + // Exclude object elements + } else if ( context.nodeName.toLowerCase() !== "object" ) { + + // Capture the context ID, setting it first if necessary + if ( (nid = context.getAttribute( "id" )) ) { + nid = nid.replace( rcssescape, fcssescape ); + } else { + context.setAttribute( "id", (nid = expando) ); + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[i] = "#" + nid + " " + toSelector( groups[i] ); + } + newSelector = groups.join( "," ); + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement("fieldset"); + + try { + return !!fn( el ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + // release memory in IE + el = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = arr.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + a.sourceIndex - b.sourceIndex; + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + + // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Only certain elements can match :enabled or :disabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled + if ( "form" in elem ) { + + // Check for inherited disabledness on relevant non-disabled elements: + // * listed form-associated elements in a disabled fieldset + // https://html.spec.whatwg.org/multipage/forms.html#category-listed + // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled + // * option elements in a disabled optgroup + // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled + // All such elements have a "form" property. + if ( elem.parentNode && elem.disabled === false ) { + + // Option elements defer to a parent optgroup if present + if ( "label" in elem ) { + if ( "label" in elem.parentNode ) { + return elem.parentNode.disabled === disabled; + } else { + return elem.disabled === disabled; + } + } + + // Support: IE 6 - 11 + // Use the isDisabled shortcut property to check for disabled fieldset ancestors + return elem.isDisabled === disabled || + + // Where there is no isDisabled, check manually + /* jshint -W018 */ + elem.isDisabled !== !disabled && + disabledAncestor( elem ) === disabled; + } + + return elem.disabled === disabled; + + // Try to winnow out elements that can't be disabled before trusting the disabled property. + // Some victims get caught in our net (label, legend, menu, track), but it shouldn't + // even exist on them, let alone have a boolean value. + } else if ( "label" in elem ) { + return elem.disabled === disabled; + } + + // Remaining elements are neither :enabled nor :disabled + return false; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, subWindow, + doc = node ? node.ownerDocument || node : preferredDoc; + + // Return early if doc is invalid or already selected + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Update global variables + document = doc; + docElem = document.documentElement; + documentIsHTML = !isXML( document ); + + // Support: IE 9-11, Edge + // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) + if ( preferredDoc !== document && + (subWindow = document.defaultView) && subWindow.top !== subWindow ) { + + // Support: IE 11, Edge + if ( subWindow.addEventListener ) { + subWindow.addEventListener( "unload", unloadHandler, false ); + + // Support: IE 9 - 10 only + } else if ( subWindow.attachEvent ) { + subWindow.attachEvent( "onunload", unloadHandler ); + } + } + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties + // (excepting IE8 booleans) + support.attributes = assert(function( el ) { + el.className = "i"; + return !el.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( el ) { + el.appendChild( document.createComment("") ); + return !el.getElementsByTagName("*").length; + }); + + // Support: IE<9 + support.getElementsByClassName = rnative.test( document.getElementsByClassName ); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programmatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( el ) { + docElem.appendChild( el ).id = expando; + return !document.getElementsByName || !document.getElementsByName( expando ).length; + }); + + // ID filter and find + if ( support.getById ) { + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var elem = context.getElementById( id ); + return elem ? [ elem ] : []; + } + }; + } else { + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== "undefined" && + elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + + // Support: IE 6 - 7 only + // getElementById is not reliable as a find shortcut + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var node, i, elems, + elem = context.getElementById( id ); + + if ( elem ) { + + // Verify the id attribute + node = elem.getAttributeNode("id"); + if ( node && node.value === id ) { + return [ elem ]; + } + + // Fall back on getElementsByName + elems = context.getElementsByName( id ); + i = 0; + while ( (elem = elems[i++]) ) { + node = elem.getAttributeNode("id"); + if ( node && node.value === id ) { + return [ elem ]; + } + } + } + + return []; + } + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else if ( support.qsa ) { + return context.querySelectorAll( tag ); + } + } : + + function( tag, context ) { + var elem, + tmp = [], + i = 0, + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See https://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( el ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // https://bugs.jquery.com/ticket/12359 + docElem.appendChild( el ).innerHTML = "" + + ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( el.querySelectorAll("[msallowcapture^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !el.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push("~="); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !el.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push(".#.+[+~]"); + } + }); + + assert(function( el ) { + el.innerHTML = "" + + ""; + + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = document.createElement("input"); + input.setAttribute( "type", "hidden" ); + el.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( el.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( el.querySelectorAll(":enabled").length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE9-11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + docElem.appendChild( el ).disabled = true; + if ( el.querySelectorAll(":disabled").length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + el.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( el ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( el, "*" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( el, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully self-exclusive + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === document ? -1 : + b === document ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + !compilerCache[ expr + " " ] && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch (e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.escape = function( sel ) { + return (sel + "").replace( rcssescape, fcssescape ); +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[6] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, uniqueCache, outerCache, node, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType, + diff = false; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) { + + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + + // Seek `elem` from a previously-cached index + + // ...in a gzip-friendly way + node = parent; + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex && cache[ 2 ]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + } else { + // Use previously-cached element index if available + if ( useCache ) { + // ...in a gzip-friendly way + node = elem; + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex; + } + + // xml :nth-child(...) + // or :nth-last-child(...) or :nth(-last)?-of-type(...) + if ( diff === false ) { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) && + ++diff ) { + + // Cache the index of each encountered element + if ( useCache ) { + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + uniqueCache[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + // Don't keep the element (issue #299) + input[0] = null; + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": createDisabledPseudo( false ), + "disabled": createDisabledPseudo( true ), + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + skip = combinator.next, + key = skip || dir, + checkNonElements = base && key === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + return false; + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, uniqueCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); + + if ( skip && skip === elem.nodeName.toLowerCase() ) { + elem = elem[ dir ] || elem; + } else if ( (oldCache = uniqueCache[ key ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + uniqueCache[ key ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + return false; + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context === document || context || outermost; + } + + // Add elements passing elementMatchers directly to results + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + if ( !context && elem.ownerDocument !== document ) { + setDocument( elem ); + xml = !documentIsHTML; + } + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context || document, xml) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // `i` is now the count of elements visited above, and adding it to `matchedCount` + // makes the latter nonnegative. + matchedCount += i; + + // Apply set filters to unmatched elements + // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` + // equals `i`), unless we didn't visit _any_ elements in the above loop because we have + // no element matchers and no seed. + // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that + // case, which will result in a "00" `matchedCount` that differs from `i` but is also + // numerically zero. + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is only one selector in the list and no seed + // (the latter of which guarantees us context) + if ( match.length === 1 ) { + + // Reduce context if the leading compound selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + !context || rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( el ) { + // Should return 1, but returns 4 (following) + return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( el ) { + el.innerHTML = ""; + return el.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( el ) { + el.innerHTML = ""; + el.firstChild.setAttribute( "value", "" ); + return el.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( el ) { + return el.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +return Sizzle; + +})( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; + +// Deprecated +jQuery.expr[ ":" ] = jQuery.expr.pseudos; +jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; +jQuery.escapeSelector = Sizzle.escape; + + + + +var dir = function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; +}; + + +var siblings = function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; +}; + + +var rneedsContext = jQuery.expr.match.needsContext; + + + +function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + +}; +var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + return !!qualifier.call( elem, i, elem ) !== not; + } ); + } + + // Single element + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + } ); + } + + // Arraylike of elements (jQuery, arguments, Array) + if ( typeof qualifier !== "string" ) { + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); + } + + // Simple selector that can be filtered directly, removing non-Elements + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + // Complex selector, compare the two sets, removing non-Elements + qualifier = jQuery.filter( qualifier, elements ); + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; + } ); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + if ( elems.length === 1 && elem.nodeType === 1 ) { + return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; + } + + return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); +}; + +jQuery.fn.extend( { + find: function( selector ) { + var i, ret, + len = this.length, + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter( function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + } ) ); + } + + ret = this.pushStack( [] ); + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + return len > 1 ? jQuery.uniqueSort( ret ) : ret; + }, + filter: function( selector ) { + return this.pushStack( winnow( this, selector || [], false ) ); + }, + not: function( selector ) { + return this.pushStack( winnow( this, selector || [], true ) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +} ); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + // Shortcut simple #id case for speed + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, + + init = jQuery.fn.init = function( selector, context, root ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Method init() accepts an alternate rootjQuery + // so migrate can support jQuery.sub (gh-2101) + root = root || rootjQuery; + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[ 0 ] === "<" && + selector[ selector.length - 1 ] === ">" && + selector.length >= 3 ) { + + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && ( match[ 1 ] || !context ) ) { + + // HANDLE: $(html) -> $(array) + if ( match[ 1 ] ) { + context = context instanceof jQuery ? context[ 0 ] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[ 1 ], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[ 2 ] ); + + if ( elem ) { + + // Inject the element directly into the jQuery object + this[ 0 ] = elem; + this.length = 1; + } + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || root ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this[ 0 ] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return root.ready !== undefined ? + root.ready( selector ) : + + // Execute immediately if ready is not present + selector( jQuery ); + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + + // Methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend( { + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter( function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[ i ] ) ) { + return true; + } + } + } ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + targets = typeof selectors !== "string" && jQuery( selectors ); + + // Positional selectors never match, since there's no _selection_ context + if ( !rneedsContext.test( selectors ) ) { + for ( ; i < l; i++ ) { + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { + + // Always skip document fragments + if ( cur.nodeType < 11 && ( targets ? + targets.index( cur ) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector( cur, selectors ) ) ) { + + matched.push( cur ); + break; + } + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); + }, + + // Determine the position of an element within the set + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // Index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.uniqueSort( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter( selector ) + ); + } +} ); + +function sibling( cur, dir ) { + while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each( { + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return siblings( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return siblings( elem.firstChild ); + }, + contents: function( elem ) { + if ( nodeName( elem, "iframe" ) ) { + return elem.contentDocument; + } + + // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only + // Treat the template element as a regular one in browsers that + // don't support it. + if ( nodeName( elem, "template" ) ) { + elem = elem.content || elem; + } + + return jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.uniqueSort( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +} ); +var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); + + + +// Convert String-formatted options into Object-formatted ones +function createOptions( options ) { + var object = {}; + jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { + object[ flag ] = true; + } ); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + createOptions( options ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + + // Last fire value for non-forgettable lists + memory, + + // Flag to know if list was already fired + fired, + + // Flag to prevent firing + locked, + + // Actual callback list + list = [], + + // Queue of execution data for repeatable lists + queue = [], + + // Index of currently firing callback (modified by add/remove as needed) + firingIndex = -1, + + // Fire callbacks + fire = function() { + + // Enforce single-firing + locked = locked || options.once; + + // Execute callbacks for all pending executions, + // respecting firingIndex overrides and runtime changes + fired = firing = true; + for ( ; queue.length; firingIndex = -1 ) { + memory = queue.shift(); + while ( ++firingIndex < list.length ) { + + // Run callback and check for early termination + if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && + options.stopOnFalse ) { + + // Jump to end and forget the data so .add doesn't re-fire + firingIndex = list.length; + memory = false; + } + } + } + + // Forget the data if we're done with it + if ( !options.memory ) { + memory = false; + } + + firing = false; + + // Clean up if we're done firing for good + if ( locked ) { + + // Keep an empty list if we have data for future add calls + if ( memory ) { + list = []; + + // Otherwise, this object is spent + } else { + list = ""; + } + } + }, + + // Actual Callbacks object + self = { + + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + + // If we have memory from a past run, we should fire after adding + if ( memory && !firing ) { + firingIndex = list.length - 1; + queue.push( memory ); + } + + ( function add( args ) { + jQuery.each( args, function( _, arg ) { + if ( jQuery.isFunction( arg ) ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { + + // Inspect recursively + add( arg ); + } + } ); + } )( arguments ); + + if ( memory && !firing ) { + fire(); + } + } + return this; + }, + + // Remove a callback from the list + remove: function() { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + + // Handle firing indexes + if ( index <= firingIndex ) { + firingIndex--; + } + } + } ); + return this; + }, + + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? + jQuery.inArray( fn, list ) > -1 : + list.length > 0; + }, + + // Remove all callbacks from the list + empty: function() { + if ( list ) { + list = []; + } + return this; + }, + + // Disable .fire and .add + // Abort any current/pending executions + // Clear all callbacks and values + disable: function() { + locked = queue = []; + list = memory = ""; + return this; + }, + disabled: function() { + return !list; + }, + + // Disable .fire + // Also disable .add unless we have memory (since it would have no effect) + // Abort any pending executions + lock: function() { + locked = queue = []; + if ( !memory && !firing ) { + list = memory = ""; + } + return this; + }, + locked: function() { + return !!locked; + }, + + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( !locked ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + queue.push( args ); + if ( !firing ) { + fire(); + } + } + return this; + }, + + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +function Identity( v ) { + return v; +} +function Thrower( ex ) { + throw ex; +} + +function adoptValue( value, resolve, reject, noValue ) { + var method; + + try { + + // Check for promise aspect first to privilege synchronous behavior + if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { + method.call( value ).done( resolve ).fail( reject ); + + // Other thenables + } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { + method.call( value, resolve, reject ); + + // Other non-thenables + } else { + + // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: + // * false: [ value ].slice( 0 ) => resolve( value ) + // * true: [ value ].slice( 1 ) => resolve() + resolve.apply( undefined, [ value ].slice( noValue ) ); + } + + // For Promises/A+, convert exceptions into rejections + // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in + // Deferred#then to conditionally suppress rejection. + } catch ( value ) { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + reject.apply( undefined, [ value ] ); + } +} + +jQuery.extend( { + + Deferred: function( func ) { + var tuples = [ + + // action, add listener, callbacks, + // ... .then handlers, argument index, [final state] + [ "notify", "progress", jQuery.Callbacks( "memory" ), + jQuery.Callbacks( "memory" ), 2 ], + [ "resolve", "done", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 0, "resolved" ], + [ "reject", "fail", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 1, "rejected" ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + "catch": function( fn ) { + return promise.then( null, fn ); + }, + + // Keep pipe for back-compat + pipe: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + + return jQuery.Deferred( function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + + // Map tuples (progress, done, fail) to arguments (done, fail, progress) + var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; + + // deferred.progress(function() { bind to newDefer or newDefer.notify }) + // deferred.done(function() { bind to newDefer or newDefer.resolve }) + // deferred.fail(function() { bind to newDefer or newDefer.reject }) + deferred[ tuple[ 1 ] ]( function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .progress( newDefer.notify ) + .done( newDefer.resolve ) + .fail( newDefer.reject ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( + this, + fn ? [ returned ] : arguments + ); + } + } ); + } ); + fns = null; + } ).promise(); + }, + then: function( onFulfilled, onRejected, onProgress ) { + var maxDepth = 0; + function resolve( depth, deferred, handler, special ) { + return function() { + var that = this, + args = arguments, + mightThrow = function() { + var returned, then; + + // Support: Promises/A+ section 2.3.3.3.3 + // https://promisesaplus.com/#point-59 + // Ignore double-resolution attempts + if ( depth < maxDepth ) { + return; + } + + returned = handler.apply( that, args ); + + // Support: Promises/A+ section 2.3.1 + // https://promisesaplus.com/#point-48 + if ( returned === deferred.promise() ) { + throw new TypeError( "Thenable self-resolution" ); + } + + // Support: Promises/A+ sections 2.3.3.1, 3.5 + // https://promisesaplus.com/#point-54 + // https://promisesaplus.com/#point-75 + // Retrieve `then` only once + then = returned && + + // Support: Promises/A+ section 2.3.4 + // https://promisesaplus.com/#point-64 + // Only check objects and functions for thenability + ( typeof returned === "object" || + typeof returned === "function" ) && + returned.then; + + // Handle a returned thenable + if ( jQuery.isFunction( then ) ) { + + // Special processors (notify) just wait for resolution + if ( special ) { + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ) + ); + + // Normal processors (resolve) also hook into progress + } else { + + // ...and disregard older resolution values + maxDepth++; + + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ), + resolve( maxDepth, deferred, Identity, + deferred.notifyWith ) + ); + } + + // Handle all other returned values + } else { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Identity ) { + that = undefined; + args = [ returned ]; + } + + // Process the value(s) + // Default process is resolve + ( special || deferred.resolveWith )( that, args ); + } + }, + + // Only normal processors (resolve) catch and reject exceptions + process = special ? + mightThrow : + function() { + try { + mightThrow(); + } catch ( e ) { + + if ( jQuery.Deferred.exceptionHook ) { + jQuery.Deferred.exceptionHook( e, + process.stackTrace ); + } + + // Support: Promises/A+ section 2.3.3.3.4.1 + // https://promisesaplus.com/#point-61 + // Ignore post-resolution exceptions + if ( depth + 1 >= maxDepth ) { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Thrower ) { + that = undefined; + args = [ e ]; + } + + deferred.rejectWith( that, args ); + } + } + }; + + // Support: Promises/A+ section 2.3.3.3.1 + // https://promisesaplus.com/#point-57 + // Re-resolve promises immediately to dodge false rejection from + // subsequent errors + if ( depth ) { + process(); + } else { + + // Call an optional hook to record the stack, in case of exception + // since it's otherwise lost when execution goes async + if ( jQuery.Deferred.getStackHook ) { + process.stackTrace = jQuery.Deferred.getStackHook(); + } + window.setTimeout( process ); + } + }; + } + + return jQuery.Deferred( function( newDefer ) { + + // progress_handlers.add( ... ) + tuples[ 0 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onProgress ) ? + onProgress : + Identity, + newDefer.notifyWith + ) + ); + + // fulfilled_handlers.add( ... ) + tuples[ 1 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onFulfilled ) ? + onFulfilled : + Identity + ) + ); + + // rejected_handlers.add( ... ) + tuples[ 2 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onRejected ) ? + onRejected : + Thrower + ) + ); + } ).promise(); + }, + + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 5 ]; + + // promise.progress = list.add + // promise.done = list.add + // promise.fail = list.add + promise[ tuple[ 1 ] ] = list.add; + + // Handle state + if ( stateString ) { + list.add( + function() { + + // state = "resolved" (i.e., fulfilled) + // state = "rejected" + state = stateString; + }, + + // rejected_callbacks.disable + // fulfilled_callbacks.disable + tuples[ 3 - i ][ 2 ].disable, + + // progress_callbacks.lock + tuples[ 0 ][ 2 ].lock + ); + } + + // progress_handlers.fire + // fulfilled_handlers.fire + // rejected_handlers.fire + list.add( tuple[ 3 ].fire ); + + // deferred.notify = function() { deferred.notifyWith(...) } + // deferred.resolve = function() { deferred.resolveWith(...) } + // deferred.reject = function() { deferred.rejectWith(...) } + deferred[ tuple[ 0 ] ] = function() { + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); + return this; + }; + + // deferred.notifyWith = list.fireWith + // deferred.resolveWith = list.fireWith + // deferred.rejectWith = list.fireWith + deferred[ tuple[ 0 ] + "With" ] = list.fireWith; + } ); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( singleValue ) { + var + + // count of uncompleted subordinates + remaining = arguments.length, + + // count of unprocessed arguments + i = remaining, + + // subordinate fulfillment data + resolveContexts = Array( i ), + resolveValues = slice.call( arguments ), + + // the master Deferred + master = jQuery.Deferred(), + + // subordinate callback factory + updateFunc = function( i ) { + return function( value ) { + resolveContexts[ i ] = this; + resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( !( --remaining ) ) { + master.resolveWith( resolveContexts, resolveValues ); + } + }; + }; + + // Single- and empty arguments are adopted like Promise.resolve + if ( remaining <= 1 ) { + adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, + !remaining ); + + // Use .then() to unwrap secondary thenables (cf. gh-3000) + if ( master.state() === "pending" || + jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { + + return master.then(); + } + } + + // Multiple arguments are aggregated like Promise.all array elements + while ( i-- ) { + adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); + } + + return master.promise(); + } +} ); + + +// These usually indicate a programmer mistake during development, +// warn about them ASAP rather than swallowing them by default. +var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; + +jQuery.Deferred.exceptionHook = function( error, stack ) { + + // Support: IE 8 - 9 only + // Console exists when dev tools are open, which can happen at any time + if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { + window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); + } +}; + + + + +jQuery.readyException = function( error ) { + window.setTimeout( function() { + throw error; + } ); +}; + + + + +// The deferred used on DOM ready +var readyList = jQuery.Deferred(); + +jQuery.fn.ready = function( fn ) { + + readyList + .then( fn ) + + // Wrap jQuery.readyException in a function so that the lookup + // happens at the time of error handling instead of callback + // registration. + .catch( function( error ) { + jQuery.readyException( error ); + } ); + + return this; +}; + +jQuery.extend( { + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + } +} ); + +jQuery.ready.then = readyList.then; + +// The ready event handler and self cleanup method +function completed() { + document.removeEventListener( "DOMContentLoaded", completed ); + window.removeEventListener( "load", completed ); + jQuery.ready(); +} + +// Catch cases where $(document).ready() is called +// after the browser event has already occurred. +// Support: IE <=9 - 10 only +// Older IE sometimes signals "interactive" too soon +if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { + + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); + +} else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); +} + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + access( elems, fn, i, key[ i ], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( + elems[ i ], key, raw ? + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) + ); + } + } + } + + if ( chainable ) { + return elems; + } + + // Gets + if ( bulk ) { + return fn.call( elems ); + } + + return len ? fn( elems[ 0 ], key ) : emptyGet; +}; +var acceptData = function( owner ) { + + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + + + + +function Data() { + this.expando = jQuery.expando + Data.uid++; +} + +Data.uid = 1; + +Data.prototype = { + + cache: function( owner ) { + + // Check if the owner object already has a cache + var value = owner[ this.expando ]; + + // If not, create one + if ( !value ) { + value = {}; + + // We can accept data for non-element nodes in modern browsers, + // but we should not, see #8335. + // Always return an empty object. + if ( acceptData( owner ) ) { + + // If it is a node unlikely to be stringify-ed or looped over + // use plain assignment + if ( owner.nodeType ) { + owner[ this.expando ] = value; + + // Otherwise secure it in a non-enumerable property + // configurable must be true to allow the property to be + // deleted when data is removed + } else { + Object.defineProperty( owner, this.expando, { + value: value, + configurable: true + } ); + } + } + } + + return value; + }, + set: function( owner, data, value ) { + var prop, + cache = this.cache( owner ); + + // Handle: [ owner, key, value ] args + // Always use camelCase key (gh-2257) + if ( typeof data === "string" ) { + cache[ jQuery.camelCase( data ) ] = value; + + // Handle: [ owner, { properties } ] args + } else { + + // Copy the properties one-by-one to the cache object + for ( prop in data ) { + cache[ jQuery.camelCase( prop ) ] = data[ prop ]; + } + } + return cache; + }, + get: function( owner, key ) { + return key === undefined ? + this.cache( owner ) : + + // Always use camelCase key (gh-2257) + owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; + }, + access: function( owner, key, value ) { + + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ( ( key && typeof key === "string" ) && value === undefined ) ) { + + return this.get( owner, key ); + } + + // When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, + cache = owner[ this.expando ]; + + if ( cache === undefined ) { + return; + } + + if ( key !== undefined ) { + + // Support array or space separated string of keys + if ( Array.isArray( key ) ) { + + // If key is an array of keys... + // We always set camelCase keys, so remove that. + key = key.map( jQuery.camelCase ); + } else { + key = jQuery.camelCase( key ); + + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + key = key in cache ? + [ key ] : + ( key.match( rnothtmlwhite ) || [] ); + } + + i = key.length; + + while ( i-- ) { + delete cache[ key[ i ] ]; + } + } + + // Remove the expando if there's no more data + if ( key === undefined || jQuery.isEmptyObject( cache ) ) { + + // Support: Chrome <=35 - 45 + // Webkit & Blink performance suffers when deleting properties + // from DOM nodes, so set to undefined instead + // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) + if ( owner.nodeType ) { + owner[ this.expando ] = undefined; + } else { + delete owner[ this.expando ]; + } + } + }, + hasData: function( owner ) { + var cache = owner[ this.expando ]; + return cache !== undefined && !jQuery.isEmptyObject( cache ); + } +}; +var dataPriv = new Data(); + +var dataUser = new Data(); + + + +// Implementation Summary +// +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /[A-Z]/g; + +function getData( data ) { + if ( data === "true" ) { + return true; + } + + if ( data === "false" ) { + return false; + } + + if ( data === "null" ) { + return null; + } + + // Only convert to a number if it doesn't change the string + if ( data === +data + "" ) { + return +data; + } + + if ( rbrace.test( data ) ) { + return JSON.parse( data ); + } + + return data; +} + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = getData( data ); + } catch ( e ) {} + + // Make sure we set the data so it isn't changed later + dataUser.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} + +jQuery.extend( { + hasData: function( elem ) { + return dataUser.hasData( elem ) || dataPriv.hasData( elem ); + }, + + data: function( elem, name, data ) { + return dataUser.access( elem, name, data ); + }, + + removeData: function( elem, name ) { + dataUser.remove( elem, name ); + }, + + // TODO: Now that all calls to _data and _removeData have been replaced + // with direct calls to dataPriv methods, these can be deprecated. + _data: function( elem, name, data ) { + return dataPriv.access( elem, name, data ); + }, + + _removeData: function( elem, name ) { + dataPriv.remove( elem, name ); + } +} ); + +jQuery.fn.extend( { + data: function( key, value ) { + var i, name, data, + elem = this[ 0 ], + attrs = elem && elem.attributes; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = dataUser.get( elem ); + + if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE 11 only + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.slice( 5 ) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + dataPriv.set( elem, "hasDataAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each( function() { + dataUser.set( this, key ); + } ); + } + + return access( this, function( value ) { + var data; + + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[ 0 ]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[ 0 ] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { + + // Attempt to get data from the cache + // The key will always be camelCased in Data + data = dataUser.get( elem, key ); + if ( data !== undefined ) { + return data; + } + + // Attempt to "discover" the data in + // HTML5 custom data-* attrs + data = dataAttr( elem, key ); + if ( data !== undefined ) { + return data; + } + + // We tried really hard, but the data doesn't exist. + return; + } + + // Set the data... + this.each( function() { + + // We always store the camelCased key + dataUser.set( this, key, value ); + } ); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each( function() { + dataUser.remove( this, key ); + } ); + } +} ); + + +jQuery.extend( { + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = dataPriv.get( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || Array.isArray( data ) ) { + queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // Clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // Not public - generate a queueHooks object, or return the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { + empty: jQuery.Callbacks( "once memory" ).add( function() { + dataPriv.remove( elem, [ type + "queue", key ] ); + } ) + } ); + } +} ); + +jQuery.fn.extend( { + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[ 0 ], type ); + } + + return data === undefined ? + this : + this.each( function() { + var queue = jQuery.queue( this, type, data ); + + // Ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + } ); + }, + dequeue: function( type ) { + return this.each( function() { + jQuery.dequeue( this, type ); + } ); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +} ); +var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; + +var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); + + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var isHiddenWithinTree = function( elem, el ) { + + // isHiddenWithinTree might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + + // Inline style trumps all + return elem.style.display === "none" || + elem.style.display === "" && + + // Otherwise, check computed style + // Support: Firefox <=43 - 45 + // Disconnected elements can have computed display: none, so first confirm that elem is + // in the document. + jQuery.contains( elem.ownerDocument, elem ) && + + jQuery.css( elem, "display" ) === "none"; + }; + +var swap = function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; +}; + + + + +function adjustCSS( elem, prop, valueParts, tween ) { + var adjusted, + scale = 1, + maxIterations = 20, + currentValue = tween ? + function() { + return tween.cur(); + } : + function() { + return jQuery.css( elem, prop, "" ); + }, + initial = currentValue(), + unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), + + // Starting value computation is required for potential unit mismatches + initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && + rcssNum.exec( jQuery.css( elem, prop ) ); + + if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { + + // Trust units reported by jQuery.css + unit = unit || initialInUnit[ 3 ]; + + // Make sure we update the tween properties later on + valueParts = valueParts || []; + + // Iteratively approximate from a nonzero starting point + initialInUnit = +initial || 1; + + do { + + // If previous iteration zeroed out, double until we get *something*. + // Use string for doubling so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + initialInUnit = initialInUnit / scale; + jQuery.style( elem, prop, initialInUnit + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // Break the loop if scale is unchanged or perfect, or if we've just had enough. + } while ( + scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations + ); + } + + if ( valueParts ) { + initialInUnit = +initialInUnit || +initial || 0; + + // Apply relative offset (+=/-=) if specified + adjusted = valueParts[ 1 ] ? + initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : + +valueParts[ 2 ]; + if ( tween ) { + tween.unit = unit; + tween.start = initialInUnit; + tween.end = adjusted; + } + } + return adjusted; +} + + +var defaultDisplayMap = {}; + +function getDefaultDisplay( elem ) { + var temp, + doc = elem.ownerDocument, + nodeName = elem.nodeName, + display = defaultDisplayMap[ nodeName ]; + + if ( display ) { + return display; + } + + temp = doc.body.appendChild( doc.createElement( nodeName ) ); + display = jQuery.css( temp, "display" ); + + temp.parentNode.removeChild( temp ); + + if ( display === "none" ) { + display = "block"; + } + defaultDisplayMap[ nodeName ] = display; + + return display; +} + +function showHide( elements, show ) { + var display, elem, + values = [], + index = 0, + length = elements.length; + + // Determine new display value for elements that need to change + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + display = elem.style.display; + if ( show ) { + + // Since we force visibility upon cascade-hidden elements, an immediate (and slow) + // check is required in this first loop unless we have a nonempty display value (either + // inline or about-to-be-restored) + if ( display === "none" ) { + values[ index ] = dataPriv.get( elem, "display" ) || null; + if ( !values[ index ] ) { + elem.style.display = ""; + } + } + if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { + values[ index ] = getDefaultDisplay( elem ); + } + } else { + if ( display !== "none" ) { + values[ index ] = "none"; + + // Remember what we're overwriting + dataPriv.set( elem, "display", display ); + } + } + } + + // Set the display of the elements in a second loop to avoid constant reflow + for ( index = 0; index < length; index++ ) { + if ( values[ index ] != null ) { + elements[ index ].style.display = values[ index ]; + } + } + + return elements; +} + +jQuery.fn.extend( { + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); + } + + return this.each( function() { + if ( isHiddenWithinTree( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + } ); + } +} ); +var rcheckableType = ( /^(?:checkbox|radio)$/i ); + +var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); + +var rscriptType = ( /^$|\/(?:java|ecma)script/i ); + + + +// We have to close these tags to support XHTML (#13200) +var wrapMap = { + + // Support: IE <=9 only + option: [ 1, "" ], + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting or other required elements. + thead: [ 1, "", "
" ], + col: [ 2, "", "
" ], + tr: [ 2, "", "
" ], + td: [ 3, "", "
" ], + + _default: [ 0, "", "" ] +}; + +// Support: IE <=9 only +wrapMap.optgroup = wrapMap.option; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + + +function getAll( context, tag ) { + + // Support: IE <=9 - 11 only + // Use typeof to avoid zero-argument method invocation on host objects (#15151) + var ret; + + if ( typeof context.getElementsByTagName !== "undefined" ) { + ret = context.getElementsByTagName( tag || "*" ); + + } else if ( typeof context.querySelectorAll !== "undefined" ) { + ret = context.querySelectorAll( tag || "*" ); + + } else { + ret = []; + } + + if ( tag === undefined || tag && nodeName( context, tag ) ) { + return jQuery.merge( [ context ], ret ); + } + + return ret; +} + + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + dataPriv.set( + elems[ i ], + "globalEval", + !refElements || dataPriv.get( refElements[ i ], "globalEval" ) + ); + } +} + + +var rhtml = /<|&#?\w+;/; + +function buildFragment( elems, context, scripts, selection, ignored ) { + var elem, tmp, tag, wrap, contains, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (#12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; +} + + +( function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Android 4.0 - 4.3 only + // Check state lost if the name is set (#11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Android <=4.1 only + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE <=11 only + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; +} )(); +var documentElement = document.documentElement; + + + +var + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +// Support: IE <=9 only +// See #13393 for more info +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +function on( elem, types, selector, data, fn, one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + on( elem, type, selector, data, types[ type ], one ); + } + return elem; + } + + if ( data == null && fn == null ) { + + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return elem; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return elem.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + } ); +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.get( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Ensure that invalid selectors throw exceptions at attach time + // Evaluate against documentElement in case elem is a non-element node (e.g., document) + if ( selector ) { + jQuery.find.matchesSelector( documentElement, selector ); + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !( events = elemData.events ) ) { + events = elemData.events = {}; + } + if ( !( eventHandle = elemData.handle ) ) { + eventHandle = elemData.handle = function( e ) { + + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend( { + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join( "." ) + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !( handlers = events[ type ] ) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || + special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); + + if ( !elemData || !( events = elemData.events ) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[ 2 ] && + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || + selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || + special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove data and the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + dataPriv.remove( elem, "handle events" ); + } + }, + + dispatch: function( nativeEvent ) { + + // Make a writable jQuery.Event from the native event object + var event = jQuery.event.fix( nativeEvent ); + + var i, j, ret, matched, handleObj, handlerQueue, + args = new Array( arguments.length ), + handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[ 0 ] = event; + + for ( i = 1; i < arguments.length; i++ ) { + args[ i ] = arguments[ i ]; + } + + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( ( handleObj = matched.handlers[ j++ ] ) && + !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or 2) have namespace(s) + // a subset or equal to those in the bound event (both can have no namespace). + if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || + handleObj.handler ).apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( ( event.result = ret ) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, handleObj, sel, matchedHandlers, matchedSelectors, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + if ( delegateCount && + + // Support: IE <=9 + // Black-hole SVG instance trees (trac-13180) + cur.nodeType && + + // Support: Firefox <=42 + // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) + // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click + // Support: IE 11 only + // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) + !( event.type === "click" && event.button >= 1 ) ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { + matchedHandlers = []; + matchedSelectors = {}; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matchedSelectors[ sel ] === undefined ) { + matchedSelectors[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) > -1 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matchedSelectors[ sel ] ) { + matchedHandlers.push( handleObj ); + } + } + if ( matchedHandlers.length ) { + handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); + } + } + } + } + + // Add the remaining (directly-bound) handlers + cur = this; + if ( delegateCount < handlers.length ) { + handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); + } + + return handlerQueue; + }, + + addProp: function( name, hook ) { + Object.defineProperty( jQuery.Event.prototype, name, { + enumerable: true, + configurable: true, + + get: jQuery.isFunction( hook ) ? + function() { + if ( this.originalEvent ) { + return hook( this.originalEvent ); + } + } : + function() { + if ( this.originalEvent ) { + return this.originalEvent[ name ]; + } + }, + + set: function( value ) { + Object.defineProperty( this, name, { + enumerable: true, + configurable: true, + writable: true, + value: value + } ); + } + } ); + }, + + fix: function( originalEvent ) { + return originalEvent[ jQuery.expando ] ? + originalEvent : + new jQuery.Event( originalEvent ); + }, + + special: { + load: { + + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + this.focus(); + return false; + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + } +}; + +jQuery.removeEvent = function( elem, type, handle ) { + + // This "if" is needed for plain objects + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle ); + } +}; + +jQuery.Event = function( src, props ) { + + // Allow instantiation without the 'new' keyword + if ( !( this instanceof jQuery.Event ) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + + // Support: Android <=2.3 only + src.returnValue === false ? + returnTrue : + returnFalse; + + // Create target properties + // Support: Safari <=6 - 7 only + // Target should not be a text node (#504, #13143) + this.target = ( src.target && src.target.nodeType === 3 ) ? + src.target.parentNode : + src.target; + + this.currentTarget = src.currentTarget; + this.relatedTarget = src.relatedTarget; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + constructor: jQuery.Event, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + isSimulated: false, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && !this.isSimulated ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Includes all common event props including KeyEvent and MouseEvent specific props +jQuery.each( { + altKey: true, + bubbles: true, + cancelable: true, + changedTouches: true, + ctrlKey: true, + detail: true, + eventPhase: true, + metaKey: true, + pageX: true, + pageY: true, + shiftKey: true, + view: true, + "char": true, + charCode: true, + key: true, + keyCode: true, + button: true, + buttons: true, + clientX: true, + clientY: true, + offsetX: true, + offsetY: true, + pointerId: true, + pointerType: true, + screenX: true, + screenY: true, + targetTouches: true, + toElement: true, + touches: true, + + which: function( event ) { + var button = event.button; + + // Add which for key events + if ( event.which == null && rkeyEvent.test( event.type ) ) { + return event.charCode != null ? event.charCode : event.keyCode; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { + if ( button & 1 ) { + return 1; + } + + if ( button & 2 ) { + return 3; + } + + if ( button & 4 ) { + return 2; + } + + return 0; + } + + return event.which; + } +}, jQuery.event.addProp ); + +// Create mouseenter/leave events using mouseover/out and event-time checks +// so that event delegation works in jQuery. +// Do the same for pointerenter/pointerleave and pointerover/pointerout +// +// Support: Safari 7 only +// Safari sends mouseenter too often; see: +// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 +// for the description of the bug (it existed in older Chrome versions as well). +jQuery.each( { + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mouseenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +} ); + +jQuery.fn.extend( { + + on: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn ); + }, + one: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? + handleObj.origType + "." + handleObj.namespace : + handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each( function() { + jQuery.event.remove( this, types, fn, selector ); + } ); + } +} ); + + +var + + /* eslint-disable max-len */ + + // See https://github.com/eslint/eslint/issues/3229 + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, + + /* eslint-enable */ + + // Support: IE <=10 - 11, Edge 12 - 13 + // In IE/Edge using regex groups here causes severe slowdowns. + // See https://connect.microsoft.com/IE/feedback/details/1736512/ + rnoInnerhtml = /\s*$/g; + +// Prefer a tbody over its parent table for containing new rows +function manipulationTarget( elem, content ) { + if ( nodeName( elem, "table" ) && + nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + + return jQuery( ">tbody", elem )[ 0 ] || elem; + } + + return elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + + if ( match ) { + elem.type = match[ 1 ]; + } else { + elem.removeAttribute( "type" ); + } + + return elem; +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( dataPriv.hasData( src ) ) { + pdataOld = dataPriv.access( src ); + pdataCur = dataPriv.set( dest, pdataOld ); + events = pdataOld.events; + + if ( events ) { + delete pdataCur.handle; + pdataCur.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( dataUser.hasData( src ) ) { + udataOld = dataUser.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + dataUser.set( dest, udataCur ); + } +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +function domManip( collection, args, callback, ignored ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = collection.length, + iNoClone = l - 1, + value = args[ 0 ], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return collection.each( function( index ) { + var self = collection.eq( index ); + if ( isFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + domManip( self, args, callback, ignored ); + } ); + } + + if ( l ) { + fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + // Require either new content or an interest in ignored elements to invoke the callback + if ( first || ignored ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item + // instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( collection[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !dataPriv.access( node, "globalEval" ) && + jQuery.contains( doc, node ) ) { + + if ( node.src ) { + + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); + } + } + } + } + } + } + + return collection; +} + +function remove( elem, selector, keepData ) { + var node, + nodes = selector ? jQuery.filter( selector, elem ) : elem, + i = 0; + + for ( ; ( node = nodes[ i ] ) != null; i++ ) { + if ( !keepData && node.nodeType === 1 ) { + jQuery.cleanData( getAll( node ) ); + } + + if ( node.parentNode ) { + if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { + setGlobalEval( getAll( node, "script" ) ); + } + node.parentNode.removeChild( node ); + } + } + + return elem; +} + +jQuery.extend( { + htmlPrefilter: function( html ) { + return html.replace( rxhtmlTag, "<$1>" ); + }, + + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = jQuery.contains( elem.ownerDocument, elem ); + + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + cleanData: function( elems ) { + var data, elem, type, + special = jQuery.event.special, + i = 0; + + for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { + if ( acceptData( elem ) ) { + if ( ( data = elem[ dataPriv.expando ] ) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataPriv.expando ] = undefined; + } + if ( elem[ dataUser.expando ] ) { + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataUser.expando ] = undefined; + } + } + } + } +} ); + +jQuery.fn.extend( { + detach: function( selector ) { + return remove( this, selector, true ); + }, + + remove: function( selector ) { + return remove( this, selector ); + }, + + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each( function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + } ); + }, null, value, arguments.length ); + }, + + append: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + } ); + }, + + prepend: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + } ); + }, + + before: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + } ); + }, + + after: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + } ); + }, + + empty: function() { + var elem, + i = 0; + + for ( ; ( elem = this[ i ] ) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + } ); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = jQuery.htmlPrefilter( value ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch ( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var ignored = []; + + // Make the changes, replacing each non-ignored context element with the new content + return domManip( this, arguments, function( elem ) { + var parent = this.parentNode; + + if ( jQuery.inArray( this, ignored ) < 0 ) { + jQuery.cleanData( getAll( this ) ); + if ( parent ) { + parent.replaceChild( elem, this ); + } + } + + // Force callback invocation + }, ignored ); + } +} ); + +jQuery.each( { + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: Android <=4.0 only, PhantomJS 1 only + // .get() because push.apply(_, arraylike) throws on ancient WebKit + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +} ); +var rmargin = ( /^margin/ ); + +var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); + +var getStyles = function( elem ) { + + // Support: IE <=11 only, Firefox <=30 (#15098, #14150) + // IE throws on elements created in popups + // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" + var view = elem.ownerDocument.defaultView; + + if ( !view || !view.opener ) { + view = window; + } + + return view.getComputedStyle( elem ); + }; + + + +( function() { + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computeStyleTests() { + + // This is a singleton, we need to execute it only once + if ( !div ) { + return; + } + + div.style.cssText = + "box-sizing:border-box;" + + "position:relative;display:block;" + + "margin:auto;border:1px;padding:1px;" + + "top:1%;width:50%"; + div.innerHTML = ""; + documentElement.appendChild( container ); + + var divStyle = window.getComputedStyle( div ); + pixelPositionVal = divStyle.top !== "1%"; + + // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 + reliableMarginLeftVal = divStyle.marginLeft === "2px"; + boxSizingReliableVal = divStyle.width === "4px"; + + // Support: Android 4.0 - 4.3 only + // Some styles come back with percentage values, even though they shouldn't + div.style.marginRight = "50%"; + pixelMarginRightVal = divStyle.marginRight === "4px"; + + documentElement.removeChild( container ); + + // Nullify the div so it wouldn't be stored in the memory and + // it will also be a sign that checks already performed + div = null; + } + + var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + // Finish early in limited (non-browser) environments + if ( !div.style ) { + return; + } + + // Support: IE <=9 - 11 only + // Style of cloned element affects source element cloned (#8908) + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + + "padding:0;margin-top:1px;position:absolute"; + container.appendChild( div ); + + jQuery.extend( support, { + pixelPosition: function() { + computeStyleTests(); + return pixelPositionVal; + }, + boxSizingReliable: function() { + computeStyleTests(); + return boxSizingReliableVal; + }, + pixelMarginRight: function() { + computeStyleTests(); + return pixelMarginRightVal; + }, + reliableMarginLeft: function() { + computeStyleTests(); + return reliableMarginLeftVal; + } + } ); +} )(); + + +function curCSS( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + + // Support: Firefox 51+ + // Retrieving style before computed somehow + // fixes an issue with getting wrong values + // on detached elements + style = elem.style; + + computed = computed || getStyles( elem ); + + // getPropertyValue is needed for: + // .css('filter') (IE 9 only, #12537) + // .css('--customProperty) (#3144) + if ( computed ) { + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: + // https://drafts.csswg.org/cssom/#resolved-values + if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret !== undefined ? + + // Support: IE <=9 - 11 only + // IE returns zIndex value as an integer. + ret + "" : + ret; +} + + +function addGetHookIf( conditionFn, hookFn ) { + + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + + // Hook not needed (or it's not possible to use it due + // to missing dependency), remove it. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + return ( this.get = hookFn ).apply( this, arguments ); + } + }; +} + + +var + + // Swappable if display is none or starts with table + // except "table", "table-cell", or "table-caption" + // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rcustomProp = /^--/, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: "0", + fontWeight: "400" + }, + + cssPrefixes = [ "Webkit", "Moz", "ms" ], + emptyStyle = document.createElement( "div" ).style; + +// Return a css property mapped to a potentially vendor prefixed property +function vendorPropName( name ) { + + // Shortcut for names that are not vendor prefixed + if ( name in emptyStyle ) { + return name; + } + + // Check for vendor prefixed names + var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in emptyStyle ) { + return name; + } + } +} + +// Return a property mapped along what jQuery.cssProps suggests or to +// a vendor prefixed property. +function finalPropName( name ) { + var ret = jQuery.cssProps[ name ]; + if ( !ret ) { + ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; + } + return ret; +} + +function setPositiveNumber( elem, value, subtract ) { + + // Any relative (+/-) values have already been + // normalized at this point + var matches = rcssNum.exec( value ); + return matches ? + + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i, + val = 0; + + // If we already have the right measurement, avoid augmentation + if ( extra === ( isBorderBox ? "border" : "content" ) ) { + i = 4; + + // Otherwise initialize for horizontal or vertical properties + } else { + i = name === "width" ? 1 : 0; + } + + for ( ; i < 4; i += 2 ) { + + // Both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // At this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + + // At this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // At this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with computed style + var valueIsBorderBox, + styles = getStyles( elem ), + val = curCSS( elem, name, styles ), + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test( val ) ) { + return val; + } + + // Check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && + ( support.boxSizingReliable() || val === elem.style[ name ] ); + + // Fall back to offsetWidth/Height when value is "auto" + // This happens for inline elements with no explicit setting (gh-3571) + if ( val === "auto" ) { + val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ]; + } + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + + // Use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +jQuery.extend( { + + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + "animationIterationCount": true, + "columnCount": true, + "fillOpacity": true, + "flexGrow": true, + "flexShrink": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + "float": "cssFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + isCustomProp = rcustomProp.test( name ), + style = elem.style; + + // Make sure that we're working with the right name. We don't + // want to query the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Gets hook for the prefixed version, then unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // Convert "+=" or "-=" to relative numbers (#7345) + if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { + value = adjustCSS( elem, name, ret ); + + // Fixes bug #9237 + type = "number"; + } + + // Make sure that null and NaN values aren't set (#7116) + if ( value == null || value !== value ) { + return; + } + + // If a number was passed in, add the unit (except for certain CSS properties) + if ( type === "number" ) { + value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); + } + + // background-* props affect original clone's values + if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !( "set" in hooks ) || + ( value = hooks.set( elem, value, extra ) ) !== undefined ) { + + if ( isCustomProp ) { + style.setProperty( name, value ); + } else { + style[ name ] = value; + } + } + + } else { + + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && + ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { + + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = jQuery.camelCase( name ), + isCustomProp = rcustomProp.test( name ); + + // Make sure that we're working with the right name. We don't + // want to modify the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Try prefixed name followed by the unprefixed name + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + // Convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Make numeric if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || isFinite( num ) ? num || 0 : val; + } + + return val; + } +} ); + +jQuery.each( [ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + + // Certain elements can have dimension info if we invisibly show them + // but it must have a current display style that would benefit + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && + + // Support: Safari 8+ + // Table columns in Safari have non-zero offsetWidth & zero + // getBoundingClientRect().width unless display is changed. + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + } ) : + getWidthOrHeight( elem, name, extra ); + } + }, + + set: function( elem, value, extra ) { + var matches, + styles = extra && getStyles( elem ), + subtract = extra && augmentWidthOrHeight( + elem, + name, + extra, + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + styles + ); + + // Convert to pixels if value adjustment is needed + if ( subtract && ( matches = rcssNum.exec( value ) ) && + ( matches[ 3 ] || "px" ) !== "px" ) { + + elem.style[ name ] = value; + value = jQuery.css( elem, name ); + } + + return setPositiveNumber( elem, value, subtract ); + } + }; +} ); + +jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, + function( elem, computed ) { + if ( computed ) { + return ( parseFloat( curCSS( elem, "marginLeft" ) ) || + elem.getBoundingClientRect().left - + swap( elem, { marginLeft: 0 }, function() { + return elem.getBoundingClientRect().left; + } ) + ) + "px"; + } + } +); + +// These hooks are used by animate to expand properties +jQuery.each( { + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // Assumes a single number if not a string + parts = typeof value === "string" ? value.split( " " ) : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +} ); + +jQuery.fn.extend( { + css: function( name, value ) { + return access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( Array.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + } +} ); + + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || jQuery.easing._default; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + // Use a property on the element directly when it is not a DOM element, + // or when there is no matching style property that exists. + if ( tween.elem.nodeType !== 1 || + tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { + return tween.elem[ tween.prop ]; + } + + // Passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails. + // Simple values such as "10px" are parsed to Float; + // complex values such as "rotate(1rad)" are returned as-is. + result = jQuery.css( tween.elem, tween.prop, "" ); + + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + + // Use step hook for back compat. + // Use cssHook if its there. + // Use .style if available and use plain properties where available. + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.nodeType === 1 && + ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || + jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Support: IE <=9 only +// Panic based approach to setting things on disconnected nodes +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p * Math.PI ) / 2; + }, + _default: "swing" +}; + +jQuery.fx = Tween.prototype.init; + +// Back compat <1.8 extension point +jQuery.fx.step = {}; + + + + +var + fxNow, inProgress, + rfxtypes = /^(?:toggle|show|hide)$/, + rrun = /queueHooks$/; + +function schedule() { + if ( inProgress ) { + if ( document.hidden === false && window.requestAnimationFrame ) { + window.requestAnimationFrame( schedule ); + } else { + window.setTimeout( schedule, jQuery.fx.interval ); + } + + jQuery.fx.tick(); + } +} + +// Animations created synchronously will run synchronously +function createFxNow() { + window.setTimeout( function() { + fxNow = undefined; + } ); + return ( fxNow = jQuery.now() ); +} + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + i = 0, + attrs = { height: type }; + + // If we include width, step value is 1 to do all cssExpand values, + // otherwise step value is 2 to skip over Left and Right + includeWidth = includeWidth ? 1 : 0; + for ( ; i < 4; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +function createTween( value, prop, animation ) { + var tween, + collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { + + // We're done with this property + return tween; + } + } +} + +function defaultPrefilter( elem, props, opts ) { + var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, + isBox = "width" in props || "height" in props, + anim = this, + orig = {}, + style = elem.style, + hidden = elem.nodeType && isHiddenWithinTree( elem ), + dataShow = dataPriv.get( elem, "fxshow" ); + + // Queue-skipping animations hijack the fx hooks + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always( function() { + + // Ensure the complete handler is called before this completes + anim.always( function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + } ); + } ); + } + + // Detect show/hide animations + for ( prop in props ) { + value = props[ prop ]; + if ( rfxtypes.test( value ) ) { + delete props[ prop ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + + // Pretend to be hidden if this is a "show" and + // there is still data from a stopped show/hide + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { + hidden = true; + + // Ignore all other no-op show/hide data + } else { + continue; + } + } + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + } + } + + // Bail out if this is a no-op like .hide().hide() + propTween = !jQuery.isEmptyObject( props ); + if ( !propTween && jQuery.isEmptyObject( orig ) ) { + return; + } + + // Restrict "overflow" and "display" styles during box animations + if ( isBox && elem.nodeType === 1 ) { + + // Support: IE <=9 - 11, Edge 12 - 13 + // Record all 3 overflow attributes because IE does not infer the shorthand + // from identically-valued overflowX and overflowY + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Identify a display type, preferring old show/hide data over the CSS cascade + restoreDisplay = dataShow && dataShow.display; + if ( restoreDisplay == null ) { + restoreDisplay = dataPriv.get( elem, "display" ); + } + display = jQuery.css( elem, "display" ); + if ( display === "none" ) { + if ( restoreDisplay ) { + display = restoreDisplay; + } else { + + // Get nonempty value(s) by temporarily forcing visibility + showHide( [ elem ], true ); + restoreDisplay = elem.style.display || restoreDisplay; + display = jQuery.css( elem, "display" ); + showHide( [ elem ] ); + } + } + + // Animate inline elements as inline-block + if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { + if ( jQuery.css( elem, "float" ) === "none" ) { + + // Restore the original display value at the end of pure show/hide animations + if ( !propTween ) { + anim.done( function() { + style.display = restoreDisplay; + } ); + if ( restoreDisplay == null ) { + display = style.display; + restoreDisplay = display === "none" ? "" : display; + } + } + style.display = "inline-block"; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + anim.always( function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + } ); + } + + // Implement show/hide animations + propTween = false; + for ( prop in orig ) { + + // General show/hide setup for this element animation + if ( !propTween ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); + } + + // Store hidden/visible for toggle so `.stop().toggle()` "reverses" + if ( toggle ) { + dataShow.hidden = !hidden; + } + + // Show elements before animating them + if ( hidden ) { + showHide( [ elem ], true ); + } + + /* eslint-disable no-loop-func */ + + anim.done( function() { + + /* eslint-enable no-loop-func */ + + // The final step of a "hide" animation is actually hiding the element + if ( !hidden ) { + showHide( [ elem ] ); + } + dataPriv.remove( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + } ); + } + + // Per-property setup + propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = propTween.start; + if ( hidden ) { + propTween.end = propTween.start; + propTween.start = 0; + } + } + } +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( Array.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // Not quite $.extend, this won't overwrite existing keys. + // Reusing 'index' because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = Animation.prefilters.length, + deferred = jQuery.Deferred().always( function() { + + // Don't match elem in the :animated selector + delete tick.elem; + } ), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + + // Support: Android 2.3 only + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ] ); + + // If there's more to do, yield + if ( percent < 1 && length ) { + return remaining; + } + + // If this was an empty animation, synthesize a final progress notification + if ( !length ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + } + + // Resolve the animation and report its conclusion + deferred.resolveWith( elem, [ animation ] ); + return false; + }, + animation = deferred.promise( { + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { + specialEasing: {}, + easing: jQuery.easing._default + }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + + // If we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // Resolve when we played the last frame; otherwise, reject + if ( gotoEnd ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + } ), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length; index++ ) { + result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + if ( jQuery.isFunction( result.stop ) ) { + jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = + jQuery.proxy( result.stop, result ); + } + return result; + } + } + + jQuery.map( props, createTween, animation ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + // Attach callbacks from options + animation + .progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + } ) + ); + + return animation; +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweeners: { + "*": [ function( prop, value ) { + var tween = this.createTween( prop, value ); + adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); + return tween; + } ] + }, + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.match( rnothtmlwhite ); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length; index++ ) { + prop = props[ index ]; + Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; + Animation.tweeners[ prop ].unshift( callback ); + } + }, + + prefilters: [ defaultPrefilter ], + + prefilter: function( callback, prepend ) { + if ( prepend ) { + Animation.prefilters.unshift( callback ); + } else { + Animation.prefilters.push( callback ); + } + } +} ); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + // Go to the end state if fx are off + if ( jQuery.fx.off ) { + opt.duration = 0; + + } else { + if ( typeof opt.duration !== "number" ) { + if ( opt.duration in jQuery.fx.speeds ) { + opt.duration = jQuery.fx.speeds[ opt.duration ]; + + } else { + opt.duration = jQuery.fx.speeds._default; + } + } + } + + // Normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.fn.extend( { + fadeTo: function( speed, to, easing, callback ) { + + // Show any hidden elements after setting opacity to 0 + return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() + + // Animate to the value specified + .end().animate( { opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations, or finishing resolves immediately + if ( empty || dataPriv.get( this, "finish" ) ) { + anim.stop( true ); + } + }; + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each( function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = dataPriv.get( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && + ( type == null || timers[ index ].queue === type ) ) { + + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // Start the next in the queue if the last step wasn't forced. + // Timers currently will call their complete callbacks, which + // will dequeue but only if they were gotoEnd. + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + } ); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each( function() { + var index, + data = dataPriv.get( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // Enable finishing flag on private data + data.finish = true; + + // Empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); + } + + // Look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // Look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // Turn off finishing flag + delete data.finish; + } ); + } +} ); + +jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +} ); + +// Generate shortcuts for custom animations +jQuery.each( { + slideDown: genFx( "show" ), + slideUp: genFx( "hide" ), + slideToggle: genFx( "toggle" ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +} ); + +jQuery.timers = []; +jQuery.fx.tick = function() { + var timer, + i = 0, + timers = jQuery.timers; + + fxNow = jQuery.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + + // Run the timer and safely remove it when done (allowing for external removal) + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + jQuery.timers.push( timer ); + jQuery.fx.start(); +}; + +jQuery.fx.interval = 13; +jQuery.fx.start = function() { + if ( inProgress ) { + return; + } + + inProgress = true; + schedule(); +}; + +jQuery.fx.stop = function() { + inProgress = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + + // Default speed + _default: 400 +}; + + +// Based off of the plugin by Clint Helfers, with permission. +// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ +jQuery.fn.delay = function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = window.setTimeout( next, time ); + hooks.stop = function() { + window.clearTimeout( timeout ); + }; + } ); +}; + + +( function() { + var input = document.createElement( "input" ), + select = document.createElement( "select" ), + opt = select.appendChild( document.createElement( "option" ) ); + + input.type = "checkbox"; + + // Support: Android <=4.3 only + // Default value for a checkbox should be "on" + support.checkOn = input.value !== ""; + + // Support: IE <=11 only + // Must access selectedIndex to make default options select + support.optSelected = opt.selected; + + // Support: IE <=11 only + // An input loses its value after becoming a radio + input = document.createElement( "input" ); + input.value = "t"; + input.type = "radio"; + support.radioValue = input.value === "t"; +} )(); + + +var boolHook, + attrHandle = jQuery.expr.attrHandle; + +jQuery.fn.extend( { + attr: function( name, value ) { + return access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each( function() { + jQuery.removeAttr( this, name ); + } ); + } +} ); + +jQuery.extend( { + attr: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set attributes on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + // Attribute hooks are determined by the lowercase version + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + hooks = jQuery.attrHooks[ name.toLowerCase() ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); + } + + if ( value !== undefined ) { + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + } + + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + elem.setAttribute( name, value + "" ); + return value; + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + ret = jQuery.find.attr( elem, name ); + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? undefined : ret; + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !support.radioValue && value === "radio" && + nodeName( elem, "input" ) ) { + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + removeAttr: function( elem, value ) { + var name, + i = 0, + + // Attribute names can contain non-HTML whitespace characters + // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 + attrNames = value && value.match( rnothtmlwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( ( name = attrNames[ i++ ] ) ) { + elem.removeAttribute( name ); + } + } + } +} ); + +// Hooks for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + elem.setAttribute( name, name ); + } + return name; + } +}; + +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { + var getter = attrHandle[ name ] || jQuery.find.attr; + + attrHandle[ name ] = function( elem, name, isXML ) { + var ret, handle, + lowercaseName = name.toLowerCase(); + + if ( !isXML ) { + + // Avoid an infinite loop by temporarily removing this function from the getter + handle = attrHandle[ lowercaseName ]; + attrHandle[ lowercaseName ] = ret; + ret = getter( elem, name, isXML ) != null ? + lowercaseName : + null; + attrHandle[ lowercaseName ] = handle; + } + return ret; + }; +} ); + + + + +var rfocusable = /^(?:input|select|textarea|button)$/i, + rclickable = /^(?:a|area)$/i; + +jQuery.fn.extend( { + prop: function( name, value ) { + return access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + return this.each( function() { + delete this[ jQuery.propFix[ name ] || name ]; + } ); + } +} ); + +jQuery.extend( { + prop: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set properties on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + return ( elem[ name ] = value ); + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + return elem[ name ]; + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + + // Support: IE <=9 - 11 only + // elem.tabIndex doesn't always return the + // correct value when it hasn't been explicitly set + // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + // Use proper attribute retrieval(#12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + if ( tabindex ) { + return parseInt( tabindex, 10 ); + } + + if ( + rfocusable.test( elem.nodeName ) || + rclickable.test( elem.nodeName ) && + elem.href + ) { + return 0; + } + + return -1; + } + } + }, + + propFix: { + "for": "htmlFor", + "class": "className" + } +} ); + +// Support: IE <=11 only +// Accessing the selectedIndex property +// forces the browser to respect setting selected +// on the option +// The getter ensures a default option is selected +// when in an optgroup +// eslint rule "no-unused-expressions" is disabled for this code +// since it considers such accessions noop +if ( !support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent && parent.parentNode ) { + parent.parentNode.selectedIndex; + } + return null; + }, + set: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + }; +} + +jQuery.each( [ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +} ); + + + + + // Strip and collapse whitespace according to HTML spec + // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace + function stripAndCollapse( value ) { + var tokens = value.match( rnothtmlwhite ) || []; + return tokens.join( " " ); + } + + +function getClass( elem ) { + return elem.getAttribute && elem.getAttribute( "class" ) || ""; +} + +jQuery.fn.extend( { + addClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnothtmlwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( !arguments.length ) { + return this.attr( "class", "" ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnothtmlwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) > -1 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value; + + if ( typeof stateVal === "boolean" && type === "string" ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + + if ( jQuery.isFunction( value ) ) { + return this.each( function( i ) { + jQuery( this ).toggleClass( + value.call( this, i, getClass( this ), stateVal ), + stateVal + ); + } ); + } + + return this.each( function() { + var className, i, self, classNames; + + if ( type === "string" ) { + + // Toggle individual class names + i = 0; + self = jQuery( this ); + classNames = value.match( rnothtmlwhite ) || []; + + while ( ( className = classNames[ i++ ] ) ) { + + // Check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } + } + + // Toggle whole class name + } else if ( value === undefined || type === "boolean" ) { + className = getClass( this ); + if ( className ) { + + // Store className if set + dataPriv.set( this, "__className__", className ); + } + + // If the element has a class name or if we're passed `false`, + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + if ( this.setAttribute ) { + this.setAttribute( "class", + className || value === false ? + "" : + dataPriv.get( this, "__className__" ) || "" + ); + } + } + } ); + }, + + hasClass: function( selector ) { + var className, elem, + i = 0; + + className = " " + selector + " "; + while ( ( elem = this[ i++ ] ) ) { + if ( elem.nodeType === 1 && + ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { + return true; + } + } + + return false; + } +} ); + + + + +var rreturn = /\r/g; + +jQuery.fn.extend( { + val: function( value ) { + var hooks, ret, isFunction, + elem = this[ 0 ]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || + jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && + "get" in hooks && + ( ret = hooks.get( elem, "value" ) ) !== undefined + ) { + return ret; + } + + ret = elem.value; + + // Handle most common string cases + if ( typeof ret === "string" ) { + return ret.replace( rreturn, "" ); + } + + // Handle cases where value is null/undef or number + return ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each( function( i ) { + var val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + + } else if ( typeof val === "number" ) { + val += ""; + + } else if ( Array.isArray( val ) ) { + val = jQuery.map( val, function( value ) { + return value == null ? "" : value + ""; + } ); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + } ); + } +} ); + +jQuery.extend( { + valHooks: { + option: { + get: function( elem ) { + + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + + // Support: IE <=10 - 11 only + // option.text throws exceptions (#14686, #14858) + // Strip and collapse whitespace + // https://html.spec.whatwg.org/#strip-and-collapse-whitespace + stripAndCollapse( jQuery.text( elem ) ); + } + }, + select: { + get: function( elem ) { + var value, option, i, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one", + values = one ? null : [], + max = one ? index + 1 : options.length; + + if ( index < 0 ) { + i = max; + + } else { + i = one ? index : 0; + } + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Support: IE <=9 only + // IE8-9 doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + + // Don't return options that are disabled or in a disabled optgroup + !option.disabled && + ( !option.parentNode.disabled || + !nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; + + while ( i-- ) { + option = options[ i ]; + + /* eslint-disable no-cond-assign */ + + if ( option.selected = + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 + ) { + optionSet = true; + } + + /* eslint-enable no-cond-assign */ + } + + // Force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + return values; + } + } + } +} ); + +// Radios and checkboxes getter/setter +jQuery.each( [ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( Array.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); + } + } + }; + if ( !support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + return elem.getAttribute( "value" ) === null ? "on" : elem.value; + }; + } +} ); + + + + +// Return jQuery for attributes-only inclusion + + +var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; + +jQuery.extend( jQuery.event, { + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "." ) > -1 ) { + + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split( "." ); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf( ":" ) < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join( "." ); + event.rnamespace = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === ( elem.ownerDocument || document ) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && + dataPriv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( ( !special._default || + special._default.apply( eventPath.pop(), data ) === false ) && + acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name as the event. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + // Piggyback on a donor event to simulate a different one + // Used only for `focus(in | out)` events + simulate: function( type, elem, event ) { + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true + } + ); + + jQuery.event.trigger( e, null, elem ); + } + +} ); + +jQuery.fn.extend( { + + trigger: function( type, data ) { + return this.each( function() { + jQuery.event.trigger( type, data, this ); + } ); + }, + triggerHandler: function( type, data ) { + var elem = this[ 0 ]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +} ); + + +jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup contextmenu" ).split( " " ), + function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; +} ); + +jQuery.fn.extend( { + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +} ); + + + + +support.focusin = "onfocusin" in window; + + +// Support: Firefox <=44 +// Firefox doesn't have focus(in | out) events +// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 +// +// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 +// focus(in | out) events fire after focus & blur events, +// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order +// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 +if ( !support.focusin ) { + jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + dataPriv.remove( doc, fix ); + + } else { + dataPriv.access( doc, fix, attaches ); + } + } + }; + } ); +} +var location = window.location; + +var nonce = jQuery.now(); + +var rquery = ( /\?/ ); + + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) { + xml = undefined; + } + + if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; +}; + + +var + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( Array.isArray( obj ) ) { + + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + + // Item is non-scalar (array or object), encode its numeric index. + buildParams( + prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", + v, + traditional, + add + ); + } + } ); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + + // Serialize scalar item. + add( prefix, obj ); + } +} + +// Serialize an array of form elements or a set of +// key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, valueOrFunction ) { + + // If value is a function, invoke it and use its return value + var value = jQuery.isFunction( valueOrFunction ) ? + valueOrFunction() : + valueOrFunction; + + s[ s.length ] = encodeURIComponent( key ) + "=" + + encodeURIComponent( value == null ? "" : value ); + }; + + // If an array was passed in, assume that it is an array of form elements. + if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + } ); + + } else { + + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ); +}; + +jQuery.fn.extend( { + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map( function() { + + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + } ) + .filter( function() { + var type = this.type; + + // Use .is( ":disabled" ) so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !rcheckableType.test( type ) ); + } ) + .map( function( i, elem ) { + var val = jQuery( this ).val(); + + if ( val == null ) { + return null; + } + + if ( Array.isArray( val ) ) { + return jQuery.map( val, function( val ) { + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ); + } + + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ).get(); + } +} ); + + +var + r20 = /%20/g, + rhash = /#.*$/, + rantiCache = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, + + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = "*/".concat( "*" ), + + // Anchor tag for parsing the document origin + originAnchor = document.createElement( "a" ); + originAnchor.href = location.href; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; + + if ( jQuery.isFunction( func ) ) { + + // For each dataType in the dataTypeExpression + while ( ( dataType = dataTypes[ i++ ] ) ) { + + // Prepend if requested + if ( dataType[ 0 ] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); + + // Otherwise append + } else { + ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if ( typeof dataTypeOrTransport === "string" && + !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + } ); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +/* Handles responses to an ajax request: + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes; + + // Remove auto dataType and get content-type in the process + while ( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +/* Chain conversions given the request and the original response + * Also sets the responseXXX fields on the jqXHR instance + */ +function ajaxConvert( s, response, jqXHR, isSuccess ) { + var conv2, current, conv, tmp, prev, + converters = {}, + + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(); + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + current = dataTypes.shift(); + + // Convert to each sequential dataType + while ( current ) { + + if ( s.responseFields[ current ] ) { + jqXHR[ s.responseFields[ current ] ] = response; + } + + // Apply the dataFilter if provided + if ( !prev && isSuccess && s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + prev = current; + current = dataTypes.shift(); + + if ( current ) { + + // There's only work to do if current dataType is non-auto + if ( current === "*" ) { + + current = prev; + + // Convert response if prev dataType is non-auto and differs from current + } else if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split( " " ); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.unshift( tmp[ 1 ] ); + } + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s.throws ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { + state: "parsererror", + error: conv ? e : "No conversion from " + prev + " to " + current + }; + } + } + } + } + } + } + + return { state: "success", data: response }; +} + +jQuery.extend( { + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: location.href, + type: "GET", + isLocal: rlocalProtocol.test( location.protocol ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /\bxml\b/, + html: /\bhtml/, + json: /\bjson\b/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText", + json: "responseJSON" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": JSON.parse, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var transport, + + // URL without anti-cache param + cacheURL, + + // Response headers + responseHeadersString, + responseHeaders, + + // timeout handle + timeoutTimer, + + // Url cleanup var + urlAnchor, + + // Request state (becomes false upon send and true upon completion) + completed, + + // To know if global events are to be dispatched + fireGlobals, + + // Loop variable + i, + + // uncached part of the url + uncached, + + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + + // Callbacks context + callbackContext = s.context || s, + + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && + ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + + // Status-dependent callbacks + statusCode = s.statusCode || {}, + + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + + // Default abort message + strAbort = "canceled", + + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( completed ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match == null ? null : match; + }, + + // Raw string + getAllResponseHeaders: function() { + return completed ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( completed == null ) { + name = requestHeadersNames[ name.toLowerCase() ] = + requestHeadersNames[ name.toLowerCase() ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( completed == null ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( completed ) { + + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } else { + + // Lazy-add the new callbacks in a way that preserves old ones + for ( code in map ) { + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ); + + // Add protocol if not provided (prefilters might expect it) + // Handle falsy url in the settings object (#10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || location.href ) + "" ) + .replace( rprotocol, location.protocol + "//" ); + + // Alias method option to type as per ticket #12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; + + // A cross-domain request is in order when the origin doesn't match the current origin. + if ( s.crossDomain == null ) { + urlAnchor = document.createElement( "a" ); + + // Support: IE <=8 - 11, Edge 12 - 13 + // IE throws exception on accessing the href property if url is malformed, + // e.g. http://example.com:80x/ + try { + urlAnchor.href = s.url; + + // Support: IE <=8 - 11 only + // Anchor's host property isn't correctly set when s.url is relative + urlAnchor.href = urlAnchor.href; + s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== + urlAnchor.protocol + "//" + urlAnchor.host; + } catch ( e ) { + + // If there is an error parsing the URL, assume it is crossDomain, + // it can be rejected by the transport if it is invalid + s.crossDomain = true; + } + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( completed ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) + fireGlobals = jQuery.event && s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + // Remove hash to simplify url manipulation + cacheURL = s.url.replace( rhash, "" ); + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // Remember the hash so we can put it back + uncached = s.url.slice( cacheURL.length ); + + // If data is available, append data to url + if ( s.data ) { + cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; + + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add or update anti-cache param if needed + if ( s.cache === false ) { + cacheURL = cacheURL.replace( rantiCache, "$1" ); + uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; + } + + // Put hash and anti-cache on the URL that will be requested (gh-1732) + s.url = cacheURL + uncached; + + // Change '%20' to '+' if this is encoded form body content (gh-2658) + } else if ( s.data && s.processData && + ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { + s.data = s.data.replace( r20, "+" ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? + s.accepts[ s.dataTypes[ 0 ] ] + + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && + ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { + + // Abort if not done already and return + return jqXHR.abort(); + } + + // Aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + completeDeferred.add( s.complete ); + jqXHR.done( s.success ); + jqXHR.fail( s.error ); + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + + // If request was aborted inside ajaxSend, stop there + if ( completed ) { + return jqXHR; + } + + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = window.setTimeout( function() { + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + completed = false; + transport.send( requestHeaders, done ); + } catch ( e ) { + + // Rethrow post-completion exceptions + if ( completed ) { + throw e; + } + + // Propagate others as results + done( -1, e ); + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Ignore repeat invocations + if ( completed ) { + return; + } + + completed = true; + + // Clear timeout if it exists + if ( timeoutTimer ) { + window.clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Determine if successful + isSuccess = status >= 200 && status < 300 || status === 304; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // Convert no matter what (that way responseXXX fields are always set) + response = ajaxConvert( s, response, jqXHR, isSuccess ); + + // If successful, handle type chaining + if ( isSuccess ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader( "Last-Modified" ); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader( "etag" ); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 || s.type === "HEAD" ) { + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + statusText = response.state; + success = response.data; + error = response.error; + isSuccess = !error; + } + } else { + + // Extract error from statusText and normalize for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + return jqXHR; + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + } +} ); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + + // Shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + // The url can be an options object (which then must have .url) + return jQuery.ajax( jQuery.extend( { + url: url, + type: method, + dataType: type, + data: data, + success: callback + }, jQuery.isPlainObject( url ) && url ) ); + }; +} ); + + +jQuery._evalUrl = function( url ) { + return jQuery.ajax( { + url: url, + + // Make this explicit, since user can override this through ajaxSetup (#11264) + type: "GET", + dataType: "script", + cache: true, + async: false, + global: false, + "throws": true + } ); +}; + + +jQuery.fn.extend( { + wrapAll: function( html ) { + var wrap; + + if ( this[ 0 ] ) { + if ( jQuery.isFunction( html ) ) { + html = html.call( this[ 0 ] ); + } + + // The elements to wrap the target around + wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); + + if ( this[ 0 ].parentNode ) { + wrap.insertBefore( this[ 0 ] ); + } + + wrap.map( function() { + var elem = this; + + while ( elem.firstElementChild ) { + elem = elem.firstElementChild; + } + + return elem; + } ).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each( function( i ) { + jQuery( this ).wrapInner( html.call( this, i ) ); + } ); + } + + return this.each( function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + } ); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each( function( i ) { + jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); + } ); + }, + + unwrap: function( selector ) { + this.parent( selector ).not( "body" ).each( function() { + jQuery( this ).replaceWith( this.childNodes ); + } ); + return this; + } +} ); + + +jQuery.expr.pseudos.hidden = function( elem ) { + return !jQuery.expr.pseudos.visible( elem ); +}; +jQuery.expr.pseudos.visible = function( elem ) { + return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); +}; + + + + +jQuery.ajaxSettings.xhr = function() { + try { + return new window.XMLHttpRequest(); + } catch ( e ) {} +}; + +var xhrSuccessStatus = { + + // File protocol always yields status code 0, assume 200 + 0: 200, + + // Support: IE <=9 only + // #1450: sometimes IE returns 1223 when it should be 204 + 1223: 204 + }, + xhrSupported = jQuery.ajaxSettings.xhr(); + +support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +support.ajax = xhrSupported = !!xhrSupported; + +jQuery.ajaxTransport( function( options ) { + var callback, errorCallback; + + // Cross domain only allowed if supported through XMLHttpRequest + if ( support.cors || xhrSupported && !options.crossDomain ) { + return { + send: function( headers, complete ) { + var i, + xhr = options.xhr(); + + xhr.open( + options.type, + options.url, + options.async, + options.username, + options.password + ); + + // Apply custom fields if provided + if ( options.xhrFields ) { + for ( i in options.xhrFields ) { + xhr[ i ] = options.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( options.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( options.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Set headers + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + + // Callback + callback = function( type ) { + return function() { + if ( callback ) { + callback = errorCallback = xhr.onload = + xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; + + if ( type === "abort" ) { + xhr.abort(); + } else if ( type === "error" ) { + + // Support: IE <=9 only + // On a manual native abort, IE9 throws + // errors on any property access that is not readyState + if ( typeof xhr.status !== "number" ) { + complete( 0, "error" ); + } else { + complete( + + // File: protocol always yields status 0; see #8605, #14207 + xhr.status, + xhr.statusText + ); + } + } else { + complete( + xhrSuccessStatus[ xhr.status ] || xhr.status, + xhr.statusText, + + // Support: IE <=9 only + // IE9 has no XHR2 but throws on binary (trac-11426) + // For XHR2 non-text, let the caller handle it (gh-2498) + ( xhr.responseType || "text" ) !== "text" || + typeof xhr.responseText !== "string" ? + { binary: xhr.response } : + { text: xhr.responseText }, + xhr.getAllResponseHeaders() + ); + } + } + }; + }; + + // Listen to events + xhr.onload = callback(); + errorCallback = xhr.onerror = callback( "error" ); + + // Support: IE 9 only + // Use onreadystatechange to replace onabort + // to handle uncaught aborts + if ( xhr.onabort !== undefined ) { + xhr.onabort = errorCallback; + } else { + xhr.onreadystatechange = function() { + + // Check readyState before timeout as it changes + if ( xhr.readyState === 4 ) { + + // Allow onerror to be called first, + // but that will not handle a native abort + // Also, save errorCallback to a variable + // as xhr.onerror cannot be accessed + window.setTimeout( function() { + if ( callback ) { + errorCallback(); + } + } ); + } + }; + } + + // Create the abort callback + callback = callback( "abort" ); + + try { + + // Do send the request (this may raise an exception) + xhr.send( options.hasContent && options.data || null ); + } catch ( e ) { + + // #14683: Only rethrow if this hasn't been notified as an error yet + if ( callback ) { + throw e; + } + } + }, + + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + +// Install script dataType +jQuery.ajaxSetup( { + accepts: { + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /\b(?:java|ecma)script\b/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +} ); + +// Handle cache's special case and crossDomain +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + } +} ); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function( s ) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + var script, callback; + return { + send: function( _, complete ) { + script = jQuery( " + + + + + + + + + + + + + + + +
+
+
+ + +
+ + +

Index

+ +
+ A + | B + | C + | D + | E + | F + | G + | H + | I + | L + | M + | N + | O + | P + | Q + | R + | S + | T + | U + | V + | W + +
+

A

+ + + +
+ +

B

+ + + +
+ +

C

+ + + +
+ +

D

+ + + +
+ +

E

+ + + +
+ +

F

+ + + +
+ +

G

+ + +
+ +

H

+ + + +
+ +

I

+ + + +
+ +

L

+ + + +
+ +

M

+ + + +
+ +

N

+ + + +
+ +

O

+ + +
+ +

P

+ + + +
+ +

Q

+ + +
+ +

R

+ + + +
+ +

S

+ + + +
+ +

T

+ + + +
+ +

U

+ + + +
+ +

V

+ + + +
+ +

W

+ + +
+ + + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/index.html b/reference/index.html new file mode 100644 index 0000000..31faacb --- /dev/null +++ b/reference/index.html @@ -0,0 +1,244 @@ + + + + + + + Getting Started — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ + +
+
+
+

Getting Started

+

Build Status Code Climate PyPy Version

+
+

Installation

+
# installing the latest signed release
+pip install twitter-ads
+
+
+
+
+

Quick Start

+
from twitter_ads.client import Client
+from twitter_ads.campaign import Campaign
+from twitter_ads.enum import ENTITY_STATUS
+
+# initialize the client
+client = Client(CONSUMER_KEY,
+                CONSUMER_SECRET,
+                ACCESS_TOKEN,
+                ACCESS_TOKEN_SECRET)
+
+# load the advertiser account instance
+account = client.accounts(ACCOUNT_ID)
+
+# load and update a specific campaign
+campaign = list(account.campaigns())[0]
+campaign.name = 'updated campaign name'
+campaign.entity_status = ENTITY_STATUS.PAUSED
+campaign.save()
+
+# iterate through campaigns
+for campaign in account.campaigns():
+    print campaign.id
+
+
+
+
+

Command Line Helper

+
# The twitter-ads command launches an interactive session for testing purposes
+# with a client instance automatically loaded from your .twurlrc file.
+
+~ ❯ twitter-ads
+
+
+

For more help please see our Examples and Guides or check the online +Reference Documentation.

+
+
+
+

Compatibility & Versioning

+

This project is designed to work with Python 2.7 or greater. While it +may work on other version of Python, below are the platform and runtime +versions we officially support and regularly test against.

+ ++++ + + + + + + + + + + + + + +

Platform

Versions

CPython

2.7, 3.5, 3.6, 3.7

PyPy

7.x

+

All releases adhere to strict semantic versioning. For Example, +major.minor.patch-pre (aka. stick.carrot.oops-peek).

+
+
+

Development

+

If you’d like to contribute to the project or try an unreleased +development version of this project locally, you can do so quite easily +by following the examples below.

+
# clone the repository
+git clone git@github.com:twitterdev/twitter-python-ads-sdk.git
+cd twitter-python-ads-sdk
+
+# install dependencies
+pip install -r requirements.txt
+
+# installing a local unsigned release
+pip install -e .
+
+
+

We love community contributions! If you’re planning to send us a pull +request, please make sure read our Contributing Guidelines first.

+
+
+

Feedback and Bug Reports

+

Found an issue? Please open up a GitHub issue or even better yet +send us a pull request. Have a question? Want to discuss a new +feature? Come chat with us in the Twitter Community Forums.

+
+
+

License

+

The MIT License (MIT)

+

Copyright (C) 2019 Twitter, Inc.

+

Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions:

+

The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software.

+

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.

+
+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/objects.inv b/reference/objects.inv new file mode 100644 index 0000000..bd06bbc Binary files /dev/null and b/reference/objects.inv differ diff --git a/reference/py-modindex.html b/reference/py-modindex.html new file mode 100644 index 0000000..a9622d6 --- /dev/null +++ b/reference/py-modindex.html @@ -0,0 +1,217 @@ + + + + + + + Python Module Index — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ + +

Python Module Index

+ +
+ a | + c | + e | + h | + r | + t | + u +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+ a
+ account +
+ audience +
 
+ c
+ campaign +
+ client +
+ creative +
+ cursor +
 
+ e
+ enum +
+ error + Module for all error types raised by the SDK.
 
+ h
+ http +
 
+ r
+ resource +
 
+ t
+ targeting +
+ twitter_ads + Base module for the Twitter Ads SDK
 
+ u
+ utils +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/search.html b/reference/search.html new file mode 100644 index 0000000..705bfe6 --- /dev/null +++ b/reference/search.html @@ -0,0 +1,126 @@ + + + + + + + Search — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Search

+
+ +

+ Please activate JavaScript to enable the search + functionality. +

+
+

+ From here you can search these documents. Enter your search + words into the box below and click "search". Note that the search + function will automatically search for all of the words. Pages + containing fewer words won't appear in the result list. +

+
+ + + +
+ +
+ +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/searchindex.js b/reference/searchindex.js new file mode 100644 index 0000000..68a142c --- /dev/null +++ b/reference/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({docnames:["index","twitter_ads/account","twitter_ads/audience","twitter_ads/campaign","twitter_ads/client","twitter_ads/creative","twitter_ads/cursor","twitter_ads/enum","twitter_ads/error","twitter_ads/http","twitter_ads/index","twitter_ads/resource","twitter_ads/targeting","twitter_ads/utils"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["index.rst","twitter_ads/account.rst","twitter_ads/audience.rst","twitter_ads/campaign.rst","twitter_ads/client.rst","twitter_ads/creative.rst","twitter_ads/cursor.rst","twitter_ads/enum.rst","twitter_ads/error.rst","twitter_ads/http.rst","twitter_ads/index.rst","twitter_ads/resource.rst","twitter_ads/targeting.rst","twitter_ads/utils.rst"],objects:{"":{"enum":[7,0,0,"-"],account:[1,0,0,"-"],audience:[2,0,0,"-"],campaign:[3,0,0,"-"],client:[4,0,0,"-"],creative:[5,0,0,"-"],cursor:[6,0,0,"-"],error:[8,0,0,"-"],http:[9,0,0,"-"],resource:[11,0,0,"-"],targeting:[12,0,0,"-"],twitter_ads:[10,0,0,"-"],utils:[13,0,0,"-"]},"account.Account":{account_media:[1,2,1,""],all:[1,2,1,""],app_lists:[1,2,1,""],campaigns:[1,2,1,""],features:[1,2,1,""],funding_instruments:[1,2,1,""],line_items:[1,2,1,""],load:[1,2,1,""],media_creatives:[1,2,1,""],promotable_users:[1,2,1,""],promoted_tweets:[1,2,1,""],reload:[1,2,1,""],scheduled_promoted_tweets:[1,2,1,""],scheduled_tweets:[1,2,1,""],tailored_audiences:[1,2,1,""],video_website_cards:[1,2,1,""]},"audience.TailoredAudience":{"delete":[2,2,1,""],create:[2,2,1,""],permissions:[2,2,1,""],users:[2,2,1,""]},"audience.TailoredAudiencePermission":{"delete":[2,2,1,""],all:[2,2,1,""],save:[2,2,1,""]},"campaign.LineItem":{targeting_criteria:[3,2,1,""]},"campaign.TargetingCriteria":{app_store_categories:[3,2,1,""],behavior_taxonomies:[3,2,1,""],behaviors:[3,2,1,""],conversations:[3,2,1,""],devices:[3,2,1,""],events:[3,2,1,""],interests:[3,2,1,""],languages:[3,2,1,""],locations:[3,2,1,""],network_operators:[3,2,1,""],platform_versions:[3,2,1,""],platforms:[3,2,1,""],tv_markets:[3,2,1,""],tv_shows:[3,2,1,""]},"campaign.TaxSettings":{load:[3,2,1,""],save:[3,2,1,""]},"client.Client":{access_token:[4,2,1,""],access_token_secret:[4,2,1,""],accounts:[4,2,1,""],consumer_key:[4,2,1,""],consumer_secret:[4,2,1,""],options:[4,2,1,""]},"creative.CardsFetch":{all:[5,2,1,""],reload:[5,2,1,""]},"creative.MediaLibrary":{"delete":[5,2,1,""],reload:[5,2,1,""],save:[5,2,1,""]},"cursor.Cursor":{count:[6,2,1,""],exhausted:[6,2,1,""],fetched:[6,2,1,""],first:[6,2,1,""],next:[6,2,1,""]},"enum":{Enum:[7,1,1,""],EnumMeta:[7,1,1,""],Flag:[7,1,1,""],IntEnum:[7,1,1,""],IntFlag:[7,1,1,""],auto:[7,1,1,""],unique:[7,4,1,""]},"enum.Enum":{name:[7,3,1,""],value:[7,3,1,""]},"error.Error":{from_response:[8,2,1,""]},"resource.Analytics":{all_stats:[11,2,1,""],async_stats_job_data:[11,2,1,""],queue_async_stats_job:[11,2,1,""],stats:[11,2,1,""]},"resource.Persistence":{"delete":[11,2,1,""],save:[11,2,1,""]},"resource.Resource":{all:[11,2,1,""],from_response:[11,2,1,""],load:[11,2,1,""],reload:[11,2,1,""],to_params:[11,2,1,""]},account:{Account:[1,1,1,""]},audience:{TailoredAudience:[2,1,1,""],TailoredAudiencePermission:[2,1,1,""]},campaign:{AppList:[3,1,1,""],Campaign:[3,1,1,""],FundingInstrument:[3,1,1,""],LineItem:[3,1,1,""],PromotableUser:[3,1,1,""],ScheduledPromotedTweet:[3,1,1,""],TargetingCriteria:[3,1,1,""],TaxSettings:[3,1,1,""],UserSettings:[3,1,1,""]},client:{Client:[4,1,1,""]},creative:{AccountMedia:[5,1,1,""],CardsFetch:[5,1,1,""],DraftTweet:[5,1,1,""],ImageAppDownloadCard:[5,1,1,""],ImageConversationCard:[5,1,1,""],MediaCreative:[5,1,1,""],MediaLibrary:[5,1,1,""],PollCard:[5,1,1,""],PromotedAccount:[5,1,1,""],PromotedTweet:[5,1,1,""],ScheduledTweet:[5,1,1,""],TweetPreview:[5,1,1,""],VideoAppDownloadCard:[5,1,1,""],VideoConversationCard:[5,1,1,""],VideoWebsiteCard:[5,1,1,""],WebsiteCard:[5,1,1,""]},cursor:{Cursor:[6,1,1,""]},error:{BadRequest:[8,5,1,""],ClientError:[8,5,1,""],Error:[8,5,1,""],Forbidden:[8,5,1,""],NotAuthorized:[8,5,1,""],NotFound:[8,5,1,""],RateLimit:[8,5,1,""],ServerError:[8,5,1,""],ServiceUnavailable:[8,5,1,""]},http:{HTTPStatus:[9,1,1,""]},resource:{Analytics:[11,1,1,""],Persistence:[11,1,1,""],Resource:[11,1,1,""],resource_property:[11,4,1,""]},utils:{format_date:[13,4,1,""],format_time:[13,4,1,""],get_version:[13,4,1,""],http_time:[13,4,1,""],remove_hours:[13,4,1,""],remove_minutes:[13,4,1,""],split_list:[13,4,1,""],to_time:[13,4,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","attribute","Python attribute"],"4":["py","function","Python function"],"5":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:attribute","4":"py:function","5":"py:exception"},terms:{"class":[1,2,3,4,5,6,7,8,9,11],"enum":0,"function":[1,4,6],"import":0,"int":7,"new":[0,2,7],"return":[1,2,3,4,5,6,8,11,13],"static":8,"true":6,"try":0,"while":0,AND:0,Ads:[1,2,3,4,5,6,8,11,12],BUT:0,FOR:0,For:0,IDs:11,NOT:0,Not:8,THE:0,The:[0,1,2,4,6,7,8],USE:0,WITH:0,abov:0,accept:2,access:4,access_token:[0,4],access_token_secret:[0,4],account:[0,2,3,4,5,11],account_id:0,account_media:1,accountmedia:5,action:0,add:2,addit:9,adher:0,ads:0,advertis:[0,1,4],against:0,aka:0,all:[0,1,2,3,5,6,8,9,11,12],all_stat:11,allow:2,also:[2,7],analyt:11,ani:0,api:[1,2,3,4,5,6,11,12],app:[1,3],app_list:1,app_store_categori:3,applist:3,appropri:7,aris:0,assign:11,associ:0,async:11,async_stats_job_data:11,asynchron:11,attribut:[1,5,11],audienc:1,author:[0,8],auto:7,automat:0,avail:[1,3,4,6],bad:8,badrequest:8,base:[7,8,11,13],basic:[4,6],behavior:3,behavior_taxonomi:3,below:0,better:0,bind:9,build:11,campaign:[0,1],can:0,card:1,cardsfetch:5,carrot:0,categori:3,charg:0,chat:0,check:0,claim:0,classmethod:[1,2,3,11],client:[0,1,6,8],clienterror:8,clone:0,code:9,coercion:11,collect:[1,2,3,4],com:0,come:0,commun:0,compliant:13,condit:0,connect:0,consum:[4,6],consumer_kei:[0,4],consumer_secret:[0,4],contain:[1,2,3,4,5,6,8,11,12],content:9,context:1,contract:0,contribut:0,convers:3,copi:0,copyright:0,correct:8,count:6,cpython:0,creat:2,creativ:1,criteria:3,curent:2,current:[1,2,3,4,5,11,13],cursor:[1,2,5,11],custor:6,damag:0,datetim:13,deal:0,decor:7,defin:7,delet:[2,5,11],delta:9,depend:[0,5,11],deriv:7,design:0,devic:3,discuss:0,distribut:0,document:0,drafttweet:5,drop:13,easili:0,encod:9,endpoint:2,ensur:7,entity_statu:0,enumer:7,enummeta:7,even:0,event:[0,3],exampl:0,except:8,exhaust:6,express:0,extens:9,far:6,featur:[0,1],fetch:6,file:0,first:[0,6],fit:0,flag:7,follow:[0,9],forbidden:8,format:13,format_d:13,format_tim:13,forum:0,found:0,framework:9,free:0,from:[0,1,2,5,7,8,9,11],from_respons:[8,11],fund:1,funding_instru:1,fundinginstru:3,furnish:0,gener:[7,11,13],get_vers:13,git:0,github:0,given:[1,2,3,5,11,13],grant:0,granular:13,greater:0,guid:0,guidelin:0,handl:11,hash:11,have:0,header:11,help:0,helper:11,herebi:0,holder:0,hour:13,http_time:13,httpstatu:9,hypertext:9,identifi:2,ids:11,imageappdownloadcard:5,imageconversationcard:5,impli:0,inc:0,includ:0,index:0,inform:[4,6],initi:0,instanc:[0,1,2,3,5,6,7,11],instrument:1,integ:7,intenum:7,interact:[0,1],interest:3,intflag:7,iso:13,issu:0,item:[1,3,6],iter:0,its:11,job:11,json:11,kind:0,klass:[6,11],kwarg:[1,2,3,4,5,6,8,11],languag:3,latest:0,launch:0,liabil:0,liabl:0,like:0,limit:[0,8],line:[1,3],line_item:1,lineitem:3,list:[0,1,3,11,13],list_:13,load:[0,1,3,11],local:0,locat:3,logic:[2,3,5,6,11,12],love:0,mai:0,maintain:[1,4],major:0,make:0,manag:[2,3,5],market:3,media:1,media_cr:1,mediacr:5,medialibrari:5,member:7,merchant:0,merg:0,metaclass:7,metric:11,metric_group:11,microsecond:13,minor:0,minut:13,mit:0,modifi:0,modul:0,more:0,multipl:2,must:7,name:[0,2,7,11],nearli:1,necessari:11,negoti:9,network:3,network_oper:3,next:6,none:[1,3,4,11],noninfring:0,notauthor:8,notfound:8,notic:0,number:[6,13],object:[1,3,5,8,11,13],observ:9,obsolet:9,obtain:0,offici:0,onlin:0,oop:0,open:0,oper:3,option:4,other:0,otherwis:0,our:0,out:0,output:11,page:0,param:2,parent:8,pars:11,particular:0,partner:2,patch:0,paus:0,peek:0,per:2,perman:9,permiss:[0,2],permit:0,persist:11,person:0,phrase:9,pip:0,plan:0,platform:[0,3],platform_vers:3,pleas:0,plugabl:11,pollcard:5,popul:11,portion:0,pre:0,presenc:[5,11],prevent:8,print:0,privat:2,project:0,promot:1,promotable_us:1,promotableus:3,promoted_tweet:1,promotedaccount:5,promotedtweet:5,properti:[4,6,11],protocol:9,provid:0,publish:0,pull:[0,11],purpos:0,pypi:0,python:[0,1,4],question:0,queue:11,queue_async_stats_job:11,quit:0,rais:8,rate:8,ratelimit:8,read:0,reason:9,redirect:9,refer:0,regularli:0,relat:[11,12],releas:0,reload:[1,5,11],remov:2,remove_hour:13,remove_minut:13,replac:7,repositori:0,represent:13,request:[0,6,8],requir:[0,2],resourc:[1,2,5],resource_properti:11,respons:[8,11],restrict:0,result:11,rfc:[9,13],right:0,round:13,runtim:0,save:[0,2,3,5,11],schedul:1,scheduled_promoted_tweet:1,scheduled_tweet:1,scheduledpromotedtweet:3,scheduledtweet:5,sdk:[0,1,2,3,4,5,6,8,11,12,13],search:0,second:13,see:0,sell:0,semant:0,send:0,server:8,servererror:8,servic:8,serviceunavail:8,session:0,set:[11,13],shall:0,show:3,sign:0,softwar:0,sourc:[1,2,3,4,5,6,7,8,9,11,13],specif:0,specifi:[11,13],split:13,split_list:13,stat:11,statu:9,stick:0,store:3,strict:0,string:13,subject:0,sublicens:0,substanti:0,suit:7,support:[0,1,3,4,7],sure:0,tailor:[1,2],tailored_audi:1,tailored_audience_id:2,tailoredaudi:2,tailoredaudiencepermiss:2,target:3,targeting_criteria:3,targetingcriteria:3,taxonomi:3,taxset:3,test:0,thi:[0,2,6,7,11],through:0,time:13,to_param:11,to_tim:13,token:4,tort:0,total:6,transfer:9,transpar:9,truncat:13,tv_market:3,tv_show:3,tweet:1,tweetpreview:5,twitter:[0,1,2,4,8],twitter_ad:0,twitterdev:0,twurlrc:0,txt:0,type:[2,8,11],unavail:8,uniqu:7,unreleas:0,unsign:0,updat:[0,2,3,5,11],url:11,use:0,used:[2,3,5,6,11,12],user:[1,2],userset:3,valu:[4,7,11],version:[3,9,13],video:1,video_website_card:1,videoappdownloadcard:5,videoconversationcard:5,videowebsitecard:5,want:0,warranti:0,webdav:9,websit:1,websitecard:5,well:2,where:7,whether:0,which:[1,4,6],whitelist:2,whom:0,without:0,work:0,yet:0,you:0,your:0,zero:13},titles:["Getting Started","account","audience","campaign","client","creative","cursor","enum","error","http","twitter_ads \u2013 Base module for the Twitter Ads SDK","resource","targeting","utils"],titleterms:{"enum":7,Ads:10,account:1,audienc:2,base:10,bug:0,campaign:3,client:4,command:0,compat:0,creativ:5,cursor:6,develop:0,error:8,feedback:0,get:0,helper:0,http:9,instal:0,licens:0,line:0,modul:10,quick:0,report:0,resourc:11,sdk:10,start:0,target:12,twitter:10,twitter_ad:10,util:13,version:0}}) \ No newline at end of file diff --git a/reference/twitter_ads/account.html b/reference/twitter_ads/account.html new file mode 100644 index 0000000..1de6975 --- /dev/null +++ b/reference/twitter_ads/account.html @@ -0,0 +1,226 @@ + + + + + + + account — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

account

+

A Twitter supported and maintained Ads API SDK for Python.

+
+
+class account.Account(client)[source]
+

The Ads API Account class which functions as a context container +for the advertiser and nearly all interactions with the API.

+
+
+account_media(id=None, **kwargs)[source]
+

Returns a collection of account media available to the current account.

+
+ +
+
+classmethod all(client, **kwargs)[source]
+

Returns a Cursor instance for a given resource.

+
+ +
+
+app_lists(id=None, **kwargs)[source]
+

Returns a collection of app lists available to the current account.

+
+ +
+
+campaigns(id=None, **kwargs)[source]
+

Returns a collection of campaigns available to the current account.

+
+ +
+
+features()[source]
+

Returns a collection of features available to the current account.

+
+ +
+
+funding_instruments(id=None, **kwargs)[source]
+

Returns a collection of funding instruments available to +the current account.

+
+ +
+
+line_items(id=None, **kwargs)[source]
+

Returns a collection of line items available to the current account.

+
+ +
+
+classmethod load(client, id, **kwargs)[source]
+

Returns an object instance for a given resource.

+
+ +
+
+media_creatives(id=None, **kwargs)[source]
+

Returns a collection of media creatives available to the current account.

+
+ +
+
+promotable_users(id=None, **kwargs)[source]
+

Returns a collection of promotable users available to the +current account.

+
+ +
+
+promoted_tweets(id=None, **kwargs)[source]
+

Returns a collection of promoted tweets available to the current account.

+
+ +
+
+reload(**kwargs)[source]
+

Reloads all attributes for the current object instance from the API.

+
+ +
+
+scheduled_promoted_tweets(id=None, **kwargs)[source]
+

Returns a collection of Scheduled Promoted Tweets available to the current account.

+
+ +
+
+scheduled_tweets(id=None, **kwargs)[source]
+

Returns a collection of Scheduled Tweets available to the current account.

+
+ +
+
+tailored_audiences(id=None, **kwargs)[source]
+

Returns a collection of tailored audiences available to the +current account.

+
+ +
+
+video_website_cards(id=None, **kwargs)[source]
+

Returns a collection of video website cards available to the current account.

+
+ +
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/audience.html b/reference/twitter_ads/audience.html new file mode 100644 index 0000000..03a1ce3 --- /dev/null +++ b/reference/twitter_ads/audience.html @@ -0,0 +1,175 @@ + + + + + + + audience — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

audience

+

Container for all audience management logic used by the Ads API SDK.

+
+
+class audience.TailoredAudience(account)[source]
+
+
+classmethod create(account, name)[source]
+

Creates a new tailored audience.

+
+ +
+
+delete()[source]
+

Deletes the current tailored audience instance.

+
+ +
+
+permissions(**kwargs)[source]
+

Returns a collection of permissions for the curent tailored audience.

+
+ +
+
+users(params)[source]
+

This is a private API and requires whitelisting from Twitter. +This endpoint will allow partners to add, update and remove users from a given +tailored_audience_id. +The endpoint will also accept multiple user identifier types per user as well.

+
+ +
+ +
+
+class audience.TailoredAudiencePermission(account)[source]
+
+
+classmethod all(account, tailored_audience_id, **kwargs)[source]
+

Returns a Cursor instance for the given tailored audience permission resource.

+
+ +
+
+delete()[source]
+

Deletes the current tailored audience permission.

+
+ +
+
+save()[source]
+

Saves or updates the current tailored audience permission.

+
+ +
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/campaign.html b/reference/twitter_ads/campaign.html new file mode 100644 index 0000000..8efdf97 --- /dev/null +++ b/reference/twitter_ads/campaign.html @@ -0,0 +1,268 @@ + + + + + + + campaign — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

campaign

+

Container for all campaign management logic used by the Ads API SDK.

+
+
+class campaign.AppList(account)[source]
+
+ +
+
+class campaign.Campaign(account)[source]
+
+ +
+
+class campaign.FundingInstrument(account)[source]
+
+ +
+
+class campaign.LineItem(account)[source]
+
+
+targeting_criteria(id=None, **kwargs)[source]
+

Returns a collection of targeting criteria available to the +current line item.

+
+ +
+ +
+
+class campaign.PromotableUser(account)[source]
+
+ +
+
+class campaign.ScheduledPromotedTweet(account)[source]
+
+ +
+
+class campaign.TargetingCriteria(account)[source]
+
+
+classmethod app_store_categories(account, **kwargs)[source]
+

Returns a list of supported app store categories

+
+ +
+
+classmethod behavior_taxonomies(account, **kwargs)[source]
+

Returns a list of supported behavior taxonomies

+
+ +
+
+classmethod behaviors(account, **kwargs)[source]
+

Returns a list of supported behaviors

+
+ +
+
+classmethod conversations(account, **kwargs)[source]
+

Returns a list of supported conversations

+
+ +
+
+classmethod devices(account, **kwargs)[source]
+

Returns a list of supported devices

+
+ +
+
+classmethod events(account, **kwargs)[source]
+

Returns a list of supported events

+
+ +
+
+classmethod interests(account, **kwargs)[source]
+

Returns a list of supported interests

+
+ +
+
+classmethod languages(account, **kwargs)[source]
+

Returns a list of supported languages

+
+ +
+
+classmethod locations(account, **kwargs)[source]
+

Returns a list of supported locations

+
+ +
+
+classmethod network_operators(account, **kwargs)[source]
+

Returns a list of supported network operators

+
+ +
+
+classmethod platform_versions(account, **kwargs)[source]
+

Returns a list of supported platform versions

+
+ +
+
+classmethod platforms(account, **kwargs)[source]
+

Returns a list of supported platforms

+
+ +
+
+classmethod tv_markets(account, **kwargs)[source]
+

Returns a list of supported TV markets

+
+ +
+
+classmethod tv_shows(account, **kwargs)[source]
+

Returns a list of supported TV shows

+
+ +
+ +
+
+class campaign.TaxSettings(account)[source]
+
+
+classmethod load(account)[source]
+

Returns an object instance for a given account.

+
+ +
+
+save()[source]
+

Update the current object instance.

+
+ +
+ +
+
+class campaign.UserSettings(account)[source]
+
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/client.html b/reference/twitter_ads/client.html new file mode 100644 index 0000000..2c685d6 --- /dev/null +++ b/reference/twitter_ads/client.html @@ -0,0 +1,164 @@ + + + + + + + client — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

client

+

A Twitter supported and maintained Ads API SDK for Python.

+
+
+class client.Client(consumer_key, consumer_secret, access_token, access_token_secret, **kwargs)[source]
+

The Ads API Client class which functions as a container for basic +API consumer information.

+
+
+property access_token
+

Returns the access_token value.

+
+ +
+
+property access_token_secret
+

Returns the access_token_secret value.

+
+ +
+
+accounts(id=None)[source]
+

Returns a collection of advertiser Accounts available to +the current access token.

+
+ +
+
+property consumer_key
+

Returns the consumer_key value.

+
+ +
+
+property consumer_secret
+

Returns the consumer_secret value.

+
+ +
+
+property options
+

Returns the options value.

+
+ +
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/creative.html b/reference/twitter_ads/creative.html new file mode 100644 index 0000000..e46f9c7 --- /dev/null +++ b/reference/twitter_ads/creative.html @@ -0,0 +1,232 @@ + + + + + + + creative — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

creative

+

Container for all creative management logic used by the Ads API SDK.

+
+
+class creative.AccountMedia(account)[source]
+
+ +
+
+class creative.CardsFetch(account)[source]
+
+
+all()[source]
+

Returns a Cursor instance for a given resource.

+
+ +
+
+reload()[source]
+

Reloads all attributes for the current object instance from the API.

+
+ +
+ +
+
+class creative.DraftTweet(account)[source]
+
+ +
+
+class creative.ImageAppDownloadCard(account)[source]
+
+ +
+
+class creative.ImageConversationCard(account)[source]
+
+ +
+
+class creative.MediaCreative(account)[source]
+
+ +
+
+class creative.MediaLibrary(account)[source]
+
+
+delete()[source]
+

Deletes the current object instance depending on the +presence of object.id.

+
+ +
+
+reload(**kwargs)[source]
+

Reloads all attributes for the current object instance from the API.

+
+ +
+
+save()[source]
+

Saves or updates the current object instance depending on the +presence of object.id.

+
+ +
+ +
+
+class creative.PollCard(account)[source]
+
+ +
+
+class creative.PromotedAccount(account)[source]
+
+ +
+
+class creative.PromotedTweet(account)[source]
+
+ +
+
+class creative.ScheduledTweet(account)[source]
+
+ +
+
+class creative.TweetPreview(account)[source]
+
+ +
+
+class creative.VideoAppDownloadCard(account)[source]
+
+ +
+
+class creative.VideoConversationCard(account)[source]
+
+ +
+
+class creative.VideoWebsiteCard(account)[source]
+
+ +
+
+class creative.WebsiteCard(account)[source]
+
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/cursor.html b/reference/twitter_ads/cursor.html new file mode 100644 index 0000000..1f1120d --- /dev/null +++ b/reference/twitter_ads/cursor.html @@ -0,0 +1,157 @@ + + + + + + + cursor — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

cursor

+

Container for all Cursor logic used by the Ads API SDK.

+
+
+class cursor.Cursor(klass, request, **kwargs)[source]
+

The Ads API Client class which functions as a container for basic +API consumer information.

+
+
+property count
+

Returns the total number of items available to this cursor instance.

+
+ +
+
+property exhausted
+

Returns True if the custor instance is exhausted.

+
+ +
+
+property fetched
+

Returns the number of items fetched so far.

+
+ +
+
+property first
+

Returns the first item of available items available to the cursor instance.

+
+ +
+
+next()[source]
+

Returns the next item in the cursor.

+
+ +
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/enum.html b/reference/twitter_ads/enum.html new file mode 100644 index 0000000..b83824a --- /dev/null +++ b/reference/twitter_ads/enum.html @@ -0,0 +1,174 @@ + + + + + + + enum — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

enum

+
+
+class enum.EnumMeta[source]
+

Metaclass for Enum

+
+ +
+
+class enum.Enum[source]
+

Generic enumeration.

+

Derive from this class to define new enumerations.

+
+
+name
+

The name of the Enum member.

+
+ +
+
+value
+

The value of the Enum member.

+
+ +
+ +
+
+class enum.IntEnum[source]
+

Enum where members are also (and must be) ints

+
+ +
+
+class enum.Flag[source]
+

Support for flags

+
+ +
+
+class enum.IntFlag[source]
+

Support for integer-based Flags

+
+ +
+
+class enum.auto[source]
+

Instances are replaced with an appropriate value in Enum class suites.

+
+ +
+
+enum.unique(enumeration)[source]
+

Class decorator for enumerations ensuring unique member values.

+
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/error.html b/reference/twitter_ads/error.html new file mode 100644 index 0000000..23304df --- /dev/null +++ b/reference/twitter_ads/error.html @@ -0,0 +1,180 @@ + + + + + + + error — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

error

+

Container for all errors raised by the Twitter Ads SDK.

+
+
+exception error.BadRequest(response, **kwargs)[source]
+

Bad Request (400).

+
+ +
+
+exception error.ClientError(response, **kwargs)[source]
+

Parent class for preventable client errors.

+
+ +
+
+exception error.Error(response, **kwargs)[source]
+

The base class for all SDK error types.

+
+
+static from_response(response)[source]
+

Returns the correct error type from a ::class::Response object.

+
+ +
+ +
+
+exception error.Forbidden(response, **kwargs)[source]
+

Forbidden (403).

+
+ +
+
+exception error.NotAuthorized(response, **kwargs)[source]
+

Not Authorized (401).

+
+ +
+
+exception error.NotFound(response, **kwargs)[source]
+

Forbidden (404).

+
+ +
+
+exception error.RateLimit(response, **kwargs)[source]
+

Rate Limit (429).

+
+ +
+
+exception error.ServerError(response, **kwargs)[source]
+

Server Error (500).

+
+ +
+
+exception error.ServiceUnavailable(response, **kwargs)[source]
+

Service Unavailable (503).

+
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/http.html b/reference/twitter_ads/http.html new file mode 100644 index 0000000..5fd1adc --- /dev/null +++ b/reference/twitter_ads/http.html @@ -0,0 +1,139 @@ + + + + + + + http — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

http

+
+
+class http.HTTPStatus[source]
+

HTTP status codes and reason phrases

+

Status codes from the following RFCs are all observed:

+
+
    +
  • RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616

  • +
  • RFC 6585: Additional HTTP Status Codes

  • +
  • RFC 3229: Delta encoding in HTTP

  • +
  • RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518

  • +
  • RFC 5842: Binding Extensions to WebDAV

  • +
  • RFC 7238: Permanent Redirect

  • +
  • RFC 2295: Transparent Content Negotiation in HTTP

  • +
  • RFC 2774: An HTTP Extension Framework

  • +
  • RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2)

  • +
+
+
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/index.html b/reference/twitter_ads/index.html new file mode 100644 index 0000000..c09f09e --- /dev/null +++ b/reference/twitter_ads/index.html @@ -0,0 +1,119 @@ + + + + + + + twitter_ads – Base module for the Twitter Ads SDK — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

twitter_ads – Base module for the Twitter Ads SDK

+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/resource.html b/reference/twitter_ads/resource.html new file mode 100644 index 0000000..b91abd6 --- /dev/null +++ b/reference/twitter_ads/resource.html @@ -0,0 +1,215 @@ + + + + + + + resource — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

resource

+

Container for all plugable resource object logic used by the Ads API SDK.

+
+
+class resource.Analytics(account)[source]
+

Container for all analytics related logic used by API resource objects.

+
+
+classmethod all_stats(account, ids, metric_groups, **kwargs)[source]
+

Pulls a list of metrics for a specified set of object IDs.

+
+ +
+
+classmethod async_stats_job_data(account, url, **kwargs)[source]
+

Returns the results of the specified async job IDs

+
+ +
+
+classmethod queue_async_stats_job(account, ids, metric_groups, **kwargs)[source]
+

Queues a list of metrics for a specified set of object IDs asynchronously

+
+ +
+
+stats(metrics, **kwargs)[source]
+

Pulls a list of metrics for the current object instance.

+
+ +
+ +
+
+class resource.Persistence[source]
+

Container for all persistence related logic used by API resource objects.

+
+
+delete()[source]
+

Deletes the current object instance depending on the +presence of object.id.

+
+ +
+
+save()[source]
+

Saves or updates the current object instance depending on the +presence of object.id.

+
+ +
+ +
+
+class resource.Resource(account)[source]
+

Base class for all API resource objects.

+
+
+classmethod all(account, **kwargs)[source]
+

Returns a Cursor instance for a given resource.

+
+ +
+
+from_response(response, headers=None)[source]
+

Populates a given objects attributes from a parsed JSON API response. +This helper handles all necessary type coercions as it assigns +attribute values.

+
+ +
+
+classmethod load(account, id, **kwargs)[source]
+

Returns an object instance for a given resource.

+
+ +
+
+reload(**kwargs)[source]
+

Reloads all attributes for the current object instance from the API.

+
+ +
+
+to_params()[source]
+

Generates a Hash of property values for the current object. This helper +handles all necessary type coercions as it generates its output.

+
+ +
+ +
+
+resource.resource_property(klass, name, **kwargs)[source]
+

Builds a resource object property.

+
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/targeting.html b/reference/twitter_ads/targeting.html new file mode 100644 index 0000000..deee0cc --- /dev/null +++ b/reference/twitter_ads/targeting.html @@ -0,0 +1,120 @@ + + + + + + + targeting — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

targeting

+

Container for all targeting related logic used by the Ads API SDK.

+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/reference/twitter_ads/utils.html b/reference/twitter_ads/utils.html new file mode 100644 index 0000000..20b0e08 --- /dev/null +++ b/reference/twitter_ads/utils.html @@ -0,0 +1,165 @@ + + + + + + + utils — Twitter Ads API SDK for Python 6.0.0 documentation + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

utils

+
+
+utils.format_date(time)[source]
+

Formats a datetime as an ISO 8601 compliant string, dropping time.

+
+ +
+
+utils.format_time(time)[source]
+

Formats a datetime as an ISO 8601 compliant string.

+
+ +
+
+utils.get_version()[source]
+

Returns a string representation of the current SDK version.

+
+ +
+
+utils.http_time(time)[source]
+

Formats a datetime as an RFC 1123 compliant string.

+
+ +
+
+utils.remove_hours(time)[source]
+

Sets the hours, minutes, seconds, and microseconds to zero.

+
+ +
+
+utils.remove_minutes(time)[source]
+

Sets the minutes, seconds, and microseconds to zero.

+
+ +
+
+utils.split_list(list_, n)[source]
+

Splits a list by a given number (n) and returns a generator object.

+
+ +
+
+utils.to_time(time, granularity)[source]
+

Returns a truncated and rounded time string based on the specified granularity.

+
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/release.sh b/release.sh deleted file mode 100755 index c125a6b..0000000 --- a/release.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -RELEASE=$(printf "from twitter_ads.utils import get_version\nprint(get_version())" | python) - -# tag the release -git tag "v$RELEASE" -git push --tags - -# clean and build new docs -cd docs && make clean && make html && cd .. - -# release new docs -git checkout gh-pages -rm -rf reference/* -cp -R docs/build/html/* reference/ -git add reference -git commit -m "\"[update] docs refresh for $RELEASE\"" -git push origin HEAD:gh-pages -git checkout master - -# push to pypi (deprecated) -# python setup.py sdist upload --sign --identity="Twitter Ads API " - -# push using twine -# build -python setup.py sdist bdist_wheel -# upload -twine upload dist/* --sign --identity="Twitter Ads API " \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 111c2e4..0000000 --- a/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -pyyaml -requests-oauthlib -python-dateutil -responses -mock -setuptools_scm -MarkupSafe -setuptools>=40.0 -configparser>=3.5 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e386c30..0000000 --- a/setup.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[aliases] -test = pytest - -[bdist_wheel] -universal = 1 - -[flake8] -filename = *.py, twitter-ads -exclude = docs/* -ignore = F403,E402,W504 -max-line-length = 100 diff --git a/setup.py b/setup.py deleted file mode 100644 index 4e423b6..0000000 --- a/setup.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2015 Twitter, Inc. - -import os -import sys -from setuptools import setup, find_packages - -DESCRIPTION = 'A Twitter supported and maintained Ads API SDK for Python.' -LONG_DESCRIPTION = None -URL = 'http://twitterdev.github.io/twitter-python-ads-sdk/' -DOWNLOAD_URL = 'https://github.com/twitterdev/twitter-python-ads-sdk/tarball/master' - - -def get_version(version_tuple): - if not isinstance(version_tuple[-1], int): - return '.'.join(map(str, version_tuple[:-1])) + version_tuple[-1] - return '.'.join(map(str, version_tuple)) - - -init = os.path.join(os.path.dirname(__file__), 'twitter_ads', '__init__.py') -version_line = list(filter(lambda l: l.startswith('VERSION'), open(init)))[0] - -VERSION = get_version(eval(version_line.split('=')[-1])) - -CLASSIFIERS = [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Internet', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Software Development :: Libraries :: Python Modules', -] - -extra_opts = { - 'setup_requires': ['flake8==3.7.7', 'pytest-runner'], - 'tests_require': ['pytest', 'responses', 'mock'] -} - -if sys.version_info[0] > 2: - extra_opts['setup_requires'].append('sphinx==2.1.1') - -setup( - name='twitter-ads', - version=VERSION, - author='John Babich, Tushar Bhushan, Juan Shishido', - author_email='jbabich@twitter.com, tbhushan@twitter.com, jshishido@twitter.com', - url=URL, - download_url=DOWNLOAD_URL, - license='MIT', - include_package_data=True, - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - platforms=['any'], - classifiers=CLASSIFIERS, - scripts=['bin/twitter-ads'], - install_requires=['pyyaml', 'requests-oauthlib', 'python-dateutil'], - packages=find_packages(exclude=['docs', 'tests']), - **extra_opts -) diff --git a/stylesheets/github-light.css b/stylesheets/github-light.css new file mode 100644 index 0000000..872a6f4 --- /dev/null +++ b/stylesheets/github-light.css @@ -0,0 +1,116 @@ +/* + Copyright 2014 GitHub Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +.pl-c /* comment */ { + color: #969896; +} + +.pl-c1 /* constant, markup.raw, meta.diff.header, meta.module-reference, meta.property-name, support, support.constant, support.variable, variable.other.constant */, +.pl-s .pl-v /* string variable */ { + color: #0086b3; +} + +.pl-e /* entity */, +.pl-en /* entity.name */ { + color: #795da3; +} + +.pl-s .pl-s1 /* string source */, +.pl-smi /* storage.modifier.import, storage.modifier.package, storage.type.java, variable.other, variable.parameter.function */ { + color: #333; +} + +.pl-ent /* entity.name.tag */ { + color: #63a35c; +} + +.pl-k /* keyword, storage, storage.type */ { + color: #a71d5d; +} + +.pl-pds /* punctuation.definition.string, string.regexp.character-class */, +.pl-s /* string */, +.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, +.pl-sr /* string.regexp */, +.pl-sr .pl-cce /* string.regexp constant.character.escape */, +.pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */, +.pl-sr .pl-sre /* string.regexp source.ruby.embedded */ { + color: #183691; +} + +.pl-v /* variable */ { + color: #ed6a43; +} + +.pl-id /* invalid.deprecated */ { + color: #b52a1d; +} + +.pl-ii /* invalid.illegal */ { + background-color: #b52a1d; + color: #f8f8f8; +} + +.pl-sr .pl-cce /* string.regexp constant.character.escape */ { + color: #63a35c; + font-weight: bold; +} + +.pl-ml /* markup.list */ { + color: #693a17; +} + +.pl-mh /* markup.heading */, +.pl-mh .pl-en /* markup.heading entity.name */, +.pl-ms /* meta.separator */ { + color: #1d3e81; + font-weight: bold; +} + +.pl-mq /* markup.quote */ { + color: #008080; +} + +.pl-mi /* markup.italic */ { + color: #333; + font-style: italic; +} + +.pl-mb /* markup.bold */ { + color: #333; + font-weight: bold; +} + +.pl-md /* markup.deleted, meta.diff.header.from-file */ { + background-color: #ffecec; + color: #bd2c00; +} + +.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { + background-color: #eaffea; + color: #55a532; +} + +.pl-mdr /* meta.diff.range */ { + color: #795da3; + font-weight: bold; +} + +.pl-mo /* meta.output */ { + color: #1d3e81; +} + diff --git a/stylesheets/styles.css b/stylesheets/styles.css new file mode 100644 index 0000000..2e1768e --- /dev/null +++ b/stylesheets/styles.css @@ -0,0 +1,324 @@ +@font-face { + font-family: 'Noto Sans'; + font-weight: 400; + font-style: normal; + src: url('../fonts/Noto-Sans-regular/Noto-Sans-regular.eot'); + src: url('../fonts/Noto-Sans-regular/Noto-Sans-regular.eot?#iefix') format('embedded-opentype'), + local('Noto Sans'), + local('Noto-Sans-regular'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.woff2') format('woff2'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.woff') format('woff'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.ttf') format('truetype'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.svg#NotoSans') format('svg'); +} + +@font-face { + font-family: 'Noto Sans'; + font-weight: 700; + font-style: normal; + src: url('../fonts/Noto-Sans-700/Noto-Sans-700.eot'); + src: url('../fonts/Noto-Sans-700/Noto-Sans-700.eot?#iefix') format('embedded-opentype'), + local('Noto Sans Bold'), + local('Noto-Sans-700'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.woff2') format('woff2'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.woff') format('woff'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.ttf') format('truetype'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.svg#NotoSans') format('svg'); +} + +@font-face { + font-family: 'Noto Sans'; + font-weight: 400; + font-style: italic; + src: url('../fonts/Noto-Sans-italic/Noto-Sans-italic.eot'); + src: url('../fonts/Noto-Sans-italic/Noto-Sans-italic.eot?#iefix') format('embedded-opentype'), + local('Noto Sans Italic'), + local('Noto-Sans-italic'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.woff2') format('woff2'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.woff') format('woff'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.ttf') format('truetype'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.svg#NotoSans') format('svg'); +} + +@font-face { + font-family: 'Noto Sans'; + font-weight: 700; + font-style: italic; + src: url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.eot'); + src: url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.eot?#iefix') format('embedded-opentype'), + local('Noto Sans Bold Italic'), + local('Noto-Sans-700italic'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.woff2') format('woff2'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.woff') format('woff'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.ttf') format('truetype'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.svg#NotoSans') format('svg'); +} + +body { + background-color: #fff; + padding:50px; + font: 14px/1.5 "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + color:#727272; + font-weight:400; +} + +h1, h2, h3, h4, h5, h6 { + color:#222; + margin:0 0 20px; +} + +p, ul, ol, table, pre, dl { + margin:0 0 20px; +} + +h1, h2, h3 { + line-height:1.1; +} + +h1 { + font-size:28px; +} + +h2 { + color:#393939; +} + +h3, h4, h5, h6 { + color:#494949; +} + +a { + color:#39c; + text-decoration:none; +} + +a:hover { + color:#069; +} + +a small { + font-size:11px; + color:#777; + margin-top:-0.3em; + display:block; +} + +a:hover small { + color:#777; +} + +.wrapper { + width:860px; + margin:0 auto; +} + +blockquote { + border-left:1px solid #e5e5e5; + margin:0; + padding:0 0 0 20px; + font-style:italic; +} + +code, pre { + font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal, Consolas, Liberation Mono, DejaVu Sans Mono, Courier New, monospace; + color:#333; + font-size:12px; +} + +pre { + padding:8px 15px; + background: #f8f8f8; + border-radius:5px; + border:1px solid #e5e5e5; + overflow-x: auto; +} + +table { + width:100%; + border-collapse:collapse; +} + +th, td { + text-align:left; + padding:5px 10px; + border-bottom:1px solid #e5e5e5; +} + +dt { + color:#444; + font-weight:700; +} + +th { + color:#444; +} + +img { + max-width:100%; +} + +header { + width:270px; + float:left; + position:fixed; + -webkit-font-smoothing:subpixel-antialiased; +} + +header ul { + list-style:none; + height:40px; + padding:0; + background: #f4f4f4; + border-radius:5px; + border:1px solid #e0e0e0; + width:270px; +} + +header li { + width:89px; + float:left; + border-right:1px solid #e0e0e0; + height:40px; +} + +header li:first-child a { + border-radius:5px 0 0 5px; +} + +header li:last-child a { + border-radius:0 5px 5px 0; +} + +header ul a { + line-height:1; + font-size:11px; + color:#999; + display:block; + text-align:center; + padding-top:6px; + height:34px; +} + +header ul a:hover { + color:#999; +} + +header ul a:active { + background-color:#f0f0f0; +} + +strong { + color:#222; + font-weight:700; +} + +header ul li + li + li { + border-right:none; + width:89px; +} + +header ul a strong { + font-size:14px; + display:block; + color:#222; +} + +section { + width:500px; + float:right; + padding-bottom:50px; +} + +small { + font-size:11px; +} + +hr { + border:0; + background:#e5e5e5; + height:1px; + margin:0 0 20px; +} + +footer { + width:270px; + float:left; + position:fixed; + bottom:50px; + -webkit-font-smoothing:subpixel-antialiased; +} + +@media print, screen and (max-width: 960px) { + + div.wrapper { + width:auto; + margin:0; + } + + header, section, footer { + float:none; + position:static; + width:auto; + } + + header { + padding-right:320px; + } + + section { + border:1px solid #e5e5e5; + border-width:1px 0; + padding:20px 0; + margin:0 0 20px; + } + + header a small { + display:inline; + } + + header ul { + position:absolute; + right:50px; + top:52px; + } +} + +@media print, screen and (max-width: 720px) { + body { + word-wrap:break-word; + } + + header { + padding:0; + } + + header ul, header p.view { + position:static; + } + + pre, code { + word-wrap:normal; + } +} + +@media print, screen and (max-width: 480px) { + body { + padding:15px; + } + + header ul { + width:99%; + } + + header li, header ul li + li + li { + width:33%; + } +} + +@media print { + body { + padding:0.4in; + font-size:12pt; + color:#444; + } +} diff --git a/tests/fixtures/accounts_all.json b/tests/fixtures/accounts_all.json deleted file mode 100644 index 7ab5ba1..0000000 --- a/tests/fixtures/accounts_all.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "request": { - "params": {} - }, - "data": [ - { - "name": "Schuppe-Casper", - "timezone": "America/Los_Angeles", - "timezone_switch_at": "2014-11-17T08:00:00Z", - "id": "2iqph", - "created_at": "2015-03-04T10:50:42Z", - "updated_at": "2015-04-11T05:20:08Z", - "approval_status": "ACCEPTED", - "deleted": false - }, - { - "name": "Schuppe-Casper", - "timezone": "America/Los_Angeles", - "timezone_switch_at": "2014-11-17T08:00:00Z", - "id": "pz6ec", - "created_at": "2015-05-29T00:52:16Z", - "updated_at": "2015-05-29T00:52:16Z", - "approval_status": "ACCEPTED", - "deleted": false - }, - { - "name": "Kozey-Farrell", - "timezone": "America/Los_Angeles", - "timezone_switch_at": "2014-11-17T08:00:00Z", - "id": "j9ozo", - "created_at": "2015-05-01T12:08:10Z", - "updated_at": "2015-05-01T12:08:10Z", - "approval_status": "ACCEPTED", - "deleted": false - }, - { - "name": "Osinski, Quitzon and Hilll", - "timezone": "America/Los_Angeles", - "timezone_switch_at": "2014-11-17T08:00:00Z", - "id": "9ttgd", - "created_at": "2015-06-24T18:51:20Z", - "updated_at": "2015-06-26T06:13:24Z", - "approval_status": "ACCEPTED", - "deleted": false - }, - { - "name": "Jakubowski-Aufderhar", - "timezone": "America/Los_Angeles", - "timezone_switch_at": "2013-05-22T07:00:00Z", - "id": "47d0v", - "created_at": "2015-05-28T05:42:03Z", - "updated_at": "2015-05-28T05:42:03Z", - "approval_status": "ACCEPTED", - "deleted": false - } - ], - "data_type": "account", - "total_count": 5, - "next_cursor": null -} diff --git a/tests/fixtures/accounts_features.json b/tests/fixtures/accounts_features.json deleted file mode 100644 index 61e1560..0000000 --- a/tests/fixtures/accounts_features.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "data_type": "features", - "data": [ - "CPI_CHARGING", - "EVENT_TARGETING", - "INSTALLED_APP_CATEGORY_TARGETING", - "MOBILE_CONVERSION_TRANSACTION_VALUE", - "OPTIMIZED_ACTION_BIDDING", - "OPTIMIZED_WEBSITE_CONVERSIONS", - "VIDEO_VIEWS_OBJECTIVE", - "VIDEO_APP_DOWNLOAD_CARD" - ], - "request": { - "params": { - "account_id": "2iqph" - } - } -} diff --git a/tests/fixtures/accounts_load.json b/tests/fixtures/accounts_load.json deleted file mode 100644 index 411fd68..0000000 --- a/tests/fixtures/accounts_load.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "data_type": "account", - "data": { - "name": "Schuppe-Casper", - "timezone": "America/Los_Angeles", - "timezone_switch_at": "2014-11-17T08:00:00Z", - "id": "2iqph", - "created_at": "2015-03-04T10:50:42Z", - "salt": "5ab2pizq7qxjjqrx3z67f4wbko61o7xs", - "updated_at": "2015-04-11T05:20:08Z", - "approval_status": "ACCEPTED", - "deleted": false - }, - "request": { - "params": { - "account_id": "2iqph" - } - } -} diff --git a/tests/fixtures/active_entities.json b/tests/fixtures/active_entities.json deleted file mode 100644 index 1e4859c..0000000 --- a/tests/fixtures/active_entities.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "data_type": "active_entities", - "request": { - "params": { - "account_id": "2iqph", - "entity": "CAMPAIGN", - "start_time": "2019-02-28T08:00:00Z", - "end_time": "2019-03-01T08:00:00Z" - } - }, - "data": [ - { - "entity_id": "2mvb28", - "activity_start_time": "2019-02-28T01:30:07Z", - "activity_end_time": "2019-03-01T07:42:55Z", - "placements": [ - "ALL_ON_TWITTER" - ] - }, - { - "entity_id": "2mvb29", - "activity_start_time": "2019-02-27T11:30:07Z", - "activity_end_time": "2019-03-01T07:42:50Z", - "placements": [ - "ALL_ON_TWITTER", - "PUBLISHER_NETWORK" - ] - }, - { - "entity_id": "2mvfan", - "activity_start_time": "2019-02-27T09:00:05Z", - "activity_end_time": "2019-03-01T06:06:36Z", - "placements": [ - "PUBLISHER_NETWORK" - ] - }, - { - "entity_id": "2n17dx", - "activity_start_time": "2019-02-28T02:02:26Z", - "activity_end_time": "2019-03-01T07:52:44Z", - "placements": [ - "ALL_ON_TWITTER", - "PUBLISHER_NETWORK" - ] - } - ] -} diff --git a/tests/fixtures/analytics_async_get.json b/tests/fixtures/analytics_async_get.json deleted file mode 100644 index d189c01..0000000 --- a/tests/fixtures/analytics_async_get.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "request": { - "params": { - "job_ids": [ - 111111111111111111 - ] - } - }, - "next_cursor": null, - "data": [ - { - "start_time": "2019-01-01T00:00:00Z", - "segmentation_type": null, - "url": "https://ton.twimg.com/advertiser-api-async-analytics/stats.json.gz", - "id": "111111111111111111", - "entity_ids": [ - "aaaa" - ], - "end_time": "2019-01-02T00:00:00Z", - "country": null, - "placement": "ALL_ON_TWITTER", - "id": 111111111111111111, - "expires_at": null, - "account_id": "2iqph", - "status": "SUCCESS", - "granularity": "TOTAL", - "entity": "CAMPAIGN", - "created_at": "2019-01-03T00:00:00Z", - "platform": null, - "updated_at": "2019-01-03T00:30:00Z", - "metric_groups": [ - "ENGAGEMENT" - ] - } - ] -} diff --git a/tests/fixtures/analytics_async_post.json b/tests/fixtures/analytics_async_post.json deleted file mode 100644 index ec5cd54..0000000 --- a/tests/fixtures/analytics_async_post.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "request": { - "params": { - "start_time": "2019-01-01T00:00:00Z", - "entity_ids": [ - "aaaa" - ], - "end_time": "2019-01-02T00:00:00Z", - "placement": "ALL_ON_TWITTER", - "granularity": "TOTAL", - "entity": "CAMPAIGN", - "metric_groups": [ - "ENGAGEMENT" - ] - } - }, - "data": { - "start_time": "2019-01-01T00:00:00Z", - "segmentation_type": null, - "url": null, - "id": "111111111111111111", - "entity_ids": [ - "aaaa" - ], - "end_time": "2019-01-02T00:00:00Z", - "country": null, - "placement": "ALL_ON_TWITTER", - "id": 111111111111111111, - "expires_at": null, - "account_id": "2iqph", - "status": "PROCESSING", - "granularity": "TOTAL", - "entity": "CAMPAIGN", - "created_at": "2019-01-03T00:00:00Z", - "platform": null, - "updated_at": "2019-01-03T00:00:00Z", - "metric_groups": [ - "ENGAGEMENT" - ] - } -} diff --git a/tests/fixtures/analytics_sync_stats.json b/tests/fixtures/analytics_sync_stats.json deleted file mode 100644 index 3e8d1db..0000000 --- a/tests/fixtures/analytics_sync_stats.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "data_type": "stats", - "time_series_length": 1, - "data": [ - { - "id": "aaaa", - "id_data": [ - { - "segment": null, - "metrics": { - "impressions": [ - 1 - ], - "tweets_send": null, - "qualified_impressions": null, - "follows": null, - "app_clicks": null, - "retweets": null, - "likes": [ - 1 - ], - "engagements": [ - 1 - ], - "clicks": [ - 1 - ], - "card_engagements": null, - "poll_card_vote": null, - "replies": null, - "url_clicks": null, - "carousel_swipes": null - } - } - ] - }, - { - "id": "bbbb", - "id_data": [ - { - "segment": null, - "metrics": { - "impressions": [ - 2 - ], - "tweets_send": null, - "qualified_impressions": null, - "follows": null, - "app_clicks": null, - "retweets": null, - "likes": [ - 2 - ], - "engagements": [ - 2 - ], - "clicks": [ - 2 - ], - "card_engagements": null, - "poll_card_vote": null, - "replies": null, - "url_clicks": null, - "carousel_swipes": null - } - } - ] - } - ], - "request": { - "params": { - "start_time": "2019-01-01T00:00:00Z", - "segmentation_type": null, - "entity_ids": [ - "aaaa", - "bbbb" - ], - "end_time": "2019-01-02T00:00:00Z", - "country": null, - "placement": "ALL_ON_TWITTER", - "granularity": "TOTAL", - "entity": "CAMPAIGN", - "platform": null, - "metric_groups": [ - "ENGAGEMENT" - ] - } - } - } \ No newline at end of file diff --git a/tests/fixtures/app_lists_all.json b/tests/fixtures/app_lists_all.json deleted file mode 100644 index 14ac013..0000000 --- a/tests/fixtures/app_lists_all.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "request" : { - "params" : { - "account_id" : "2iqph" - } - }, - "data_type" : "app_list", - "data" : [ - { - "name" : "Some test app list", - "id" : "abc2" - }, - { - "name" : "Yet another app list", - "id" : "wdpr" - }, - { - "name" : "The best app list yet", - "id" : "wdps" - } - ] -} \ No newline at end of file diff --git a/tests/fixtures/app_lists_load.json b/tests/fixtures/app_lists_load.json deleted file mode 100644 index 1445b0f..0000000 --- a/tests/fixtures/app_lists_load.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "data_type" : "app_list", - "data" : { - "apps" : [ - { - "os_type" : "Android", - "app_store_identifier" : "com.supercell.clashofclans" - }, - { - "app_store_identifier" : "com.functionx.viggle", - "os_type" : "Android" - }, - { - "app_store_identifier" : "io.fabric.samples.cannonball", - "os_type" : "Android" - }, - { - "os_type" : "Android", - "app_store_identifier" : "com.hoteltonight.android.prod" - } - ], - "name" : "Some test app list", - "id" : "abc2" - }, - "request" : { - "params" : { - "account_id" : "2iqph", - "app_list_id" : "abc2" - } - } -} diff --git a/tests/fixtures/audience_estimate.json b/tests/fixtures/audience_estimate.json deleted file mode 100644 index e8dd488..0000000 --- a/tests/fixtures/audience_estimate.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": { - "params": { - "targeting_criteria": null, - "account_id": "2iqph" - } - }, - "data": { - "audience_size": { - "min": 41133600, - "max": 50274400 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/campaigns_all.json b/tests/fixtures/campaigns_all.json deleted file mode 100644 index 80a63af..0000000 --- a/tests/fixtures/campaigns_all.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "request": { - "params": { - "account_id": "2iqph" - } - }, - "data": [ - { - "name": "Intelligent Granite Computer", - "start_time": "2015-08-12T20:26:23Z", - "reasons_not_servable": [], - "servable": true, - "daily_budget_amount_local_micro": 1000000, - "end_time": null, - "funding_instrument_id": "5aa0p", - "standard_delivery": true, - "total_budget_amount_local_micro": null, - "id": "2wap7", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-08-12T20:26:24Z", - "updated_at": "2015-08-12T20:26:24Z", - "deleted": false - }, - { - "name": "Awesome Wooden Table", - "start_time": "2015-08-12T20:17:19Z", - "reasons_not_servable": [ - "EXPIRED" - ], - "servable": false, - "daily_budget_amount_local_micro": 1000000, - "end_time": "2015-08-14T20:17:19Z", - "funding_instrument_id": "5aa0p", - "standard_delivery": true, - "total_budget_amount_local_micro": null, - "id": "2wamv", - "entity_status": "PAUSED", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-08-12T20:17:39Z", - "updated_at": "2015-08-12T20:18:21Z", - "deleted": false - }, - { - "name": "Fantastic Concrete Car", - "start_time": "2015-08-12T19:56:08Z", - "reasons_not_servable": [ - "EXPIRED", - "FUNDING_PROBLEM" - ], - "servable": false, - "daily_budget_amount_local_micro": 1000000, - "end_time": null, - "funding_instrument_id": "7cdql", - "standard_delivery": true, - "total_budget_amount_local_micro": null, - "id": "2wai9", - "entity_status": "PAUSED", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-08-12T19:56:10Z", - "updated_at": "2015-08-12T19:56:10Z", - "deleted": false - }, - { - "name": "Small Concrete Hat", - "start_time": "2015-06-29T22:00:00Z", - "reasons_not_servable": [ - "PAUSED_BY_ADVERTISER" - ], - "servable": false, - "daily_budget_amount_local_micro": 1000000, - "end_time": null, - "funding_instrument_id": "5aa0p", - "standard_delivery": true, - "total_budget_amount_local_micro": 1000000, - "id": "2of1n", - "entity_status": "PAUSED", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-06-29T22:24:17Z", - "updated_at": "2015-08-12T18:58:56Z", - "deleted": false - }, - { - "name": "Rustic Rubber Pants", - "start_time": "2015-08-12T18:09:27Z", - "reasons_not_servable": [ - "EXPIRED", - "FUNDING_PROBLEM" - ], - "servable": false, - "daily_budget_amount_local_micro": 1000000, - "end_time": null, - "funding_instrument_id": "7cdql", - "standard_delivery": true, - "total_budget_amount_local_micro": null, - "id": "2w9n1", - "entity_status": "PAUSED", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-08-12T18:09:28Z", - "updated_at": "2015-08-12T18:09:28Z", - "deleted": false - }, - { - "name": "Incredible Wooden Car", - "start_time": "2015-08-10T21:58:00Z", - "reasons_not_servable": [ - "PAUSED_BY_ADVERTISER" - ], - "servable": false, - "daily_budget_amount_local_micro": 1000000, - "end_time": null, - "funding_instrument_id": "5aa0p", - "standard_delivery": true, - "total_budget_amount_local_micro": 1000000, - "id": "2vuug", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-08-10T21:58:39Z", - "updated_at": "2015-08-10T21:59:43Z", - "deleted": false - }, - { - "name": "Gorgeous Cotton Computer", - "start_time": "2015-08-10T21:06:00Z", - "reasons_not_servable": [], - "servable": true, - "daily_budget_amount_local_micro": 1000000, - "end_time": null, - "funding_instrument_id": "5aa0p", - "standard_delivery": true, - "total_budget_amount_local_micro": null, - "id": "2vuj3", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-08-10T21:06:04Z", - "updated_at": "2015-08-10T21:06:04Z", - "deleted": false - }, - { - "name": "Sleek Rubber Car", - "start_time": "2015-08-06T06:53:00Z", - "reasons_not_servable": [], - "servable": true, - "daily_budget_amount_local_micro": 10000, - "end_time": null, - "funding_instrument_id": "5aa0p", - "standard_delivery": true, - "total_budget_amount_local_micro": 10000, - "id": "2v3c4", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-08-06T06:54:13Z", - "updated_at": "2015-08-06T06:54:13Z", - "deleted": false - }, - { - "name": "Practical Plastic Computer", - "start_time": "2015-08-04T23:20:10Z", - "reasons_not_servable": [ - "INCOMPLETE" - ], - "servable": false, - "daily_budget_amount_local_micro": 100000000, - "end_time": null, - "funding_instrument_id": "5aa0p", - "standard_delivery": true, - "total_budget_amount_local_micro": 100000000, - "id": "2uubq", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-08-04T23:20:11Z", - "updated_at": "2015-08-04T23:20:11Z", - "deleted": false - }, - { - "name": "Ergonomic Rubber Car", - "start_time": "2015-07-29T23:04:00Z", - "reasons_not_servable": [ - "PAUSED_BY_ADVERTISER" - ], - "servable": false, - "daily_budget_amount_local_micro": 1000000, - "end_time": null, - "funding_instrument_id": "5aa0p", - "standard_delivery": true, - "total_budget_amount_local_micro": null, - "id": "2ttv3", - "entity_status": "PAUSED", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-07-29T23:05:56Z", - "updated_at": "2015-07-31T18:01:26Z", - "deleted": false - } - ], - "data_type": "campaign", - "total_count": 10, - "next_cursor": null -} diff --git a/tests/fixtures/campaigns_load.json b/tests/fixtures/campaigns_load.json deleted file mode 100644 index 09f3314..0000000 --- a/tests/fixtures/campaigns_load.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "data_type": "campaign", - "data": { - "name": "Intelligent Granite Computer", - "start_time": "2015-08-12T20:26:23Z", - "reasons_not_servable": [], - "servable": true, - "daily_budget_amount_local_micro": 1000000, - "end_time": null, - "funding_instrument_id": "5aa0p", - "standard_delivery": true, - "total_budget_amount_local_micro": null, - "id": "2wap7", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "currency": "USD", - "created_at": "2015-08-12T20:26:24Z", - "updated_at": "2015-08-12T20:26:24Z", - "deleted": false - }, - "request": { - "params": { - "campaign_id": "2wap7", - "account_id": "2iqph" - } - } -} diff --git a/tests/fixtures/cards_all.json b/tests/fixtures/cards_all.json deleted file mode 100644 index 1feec12..0000000 --- a/tests/fixtures/cards_all.json +++ /dev/null @@ -1,836 +0,0 @@ -{ - "request": { - "params": { - "account_id": "2iqph" - } - }, - "next_cursor": null, - "data": [ - { - "name": "website carousel", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "https://www.dell.de/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1340029888649076737", - "created_at": "2020-12-18T20:23:16Z", - "card_uri": "card://1340029888649076737", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410461519343591424", - "created_at": "2021-07-01T04:53:25Z", - "card_uri": "card://1410461519343591424", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410461595289853954", - "created_at": "2021-07-01T04:53:44Z", - "card_uri": "card://1410461595289853954", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410461798390591491", - "created_at": "2021-07-01T04:54:32Z", - "card_uri": "card://1410461798390591491", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410461877499359237", - "created_at": "2021-07-01T04:54:51Z", - "card_uri": "card://1410461877499359237", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410461997494276100", - "created_at": "2021-07-01T04:55:19Z", - "card_uri": "card://1410461997494276100", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410462120282521603", - "created_at": "2021-07-01T04:55:49Z", - "card_uri": "card://1410462120282521603", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410462217586102272", - "created_at": "2021-07-01T04:56:12Z", - "card_uri": "card://1410462217586102272", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410462382632042496", - "created_at": "2021-07-01T04:56:51Z", - "card_uri": "card://1410462382632042496", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410702122887237632", - "created_at": "2021-07-01T20:49:30Z", - "card_uri": "card://1410702122887237632", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410702325044301827", - "created_at": "2021-07-01T20:50:18Z", - "card_uri": "card://1410702325044301827", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410702487212883969", - "created_at": "2021-07-01T20:50:57Z", - "card_uri": "card://1410702487212883969", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410702742541148162", - "created_at": "2021-07-01T20:51:58Z", - "card_uri": "card://1410702742541148162", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410703177888849923", - "created_at": "2021-07-01T20:53:41Z", - "card_uri": "card://1410703177888849923", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "video website card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1410703377667821568", - "created_at": "2021-07-01T20:54:29Z", - "card_uri": "card://1410703377667821568", - "updated_at": "2021-08-26T19:09:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "new card pytest", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1502039535651196928", - "created_at": "2022-03-10T21:51:46Z", - "card_uri": "card://1502039535651196928", - "updated_at": "2022-03-10T21:51:46Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "new card pytest", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1502039980394254337", - "created_at": "2022-03-10T21:53:32Z", - "card_uri": "card://1502039980394254337", - "updated_at": "2022-03-10T21:53:32Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "new card pytest", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/newvalue", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1502039983049232388", - "created_at": "2022-03-10T21:53:33Z", - "card_uri": "card://1502039983049232388", - "updated_at": "2022-03-10T21:53:33Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "new card pytest", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1502039996441628673", - "created_at": "2022-03-10T21:53:36Z", - "card_uri": "card://1502039996441628673", - "updated_at": "2022-03-10T21:53:36Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "new card pytest", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/newvalue", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1502039998987587584", - "created_at": "2022-03-10T21:53:36Z", - "card_uri": "card://1502039998987587584", - "updated_at": "2022-03-10T21:53:36Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "my new card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/login", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1503829009708175360", - "created_at": "2022-03-15T20:22:30Z", - "card_uri": "card://1503829009708175360", - "updated_at": "2022-03-15T20:22:30Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "my new card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/login", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1503829523753697280", - "created_at": "2022-03-15T20:24:32Z", - "card_uri": "card://1503829523753697280", - "updated_at": "2022-03-15T20:24:32Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "my new card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/login", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1503829695233617920", - "created_at": "2022-03-15T20:25:13Z", - "card_uri": "card://1503829695233617920", - "updated_at": "2022-03-15T20:25:13Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "my new card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/login", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1503829883746598912", - "created_at": "2022-03-15T20:25:58Z", - "card_uri": "card://1503829883746598912", - "updated_at": "2022-03-15T20:25:58Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - }, - { - "name": "my new card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/login", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1503831318555086849", - "created_at": "2022-03-15T20:31:40Z", - "card_uri": "card://1503831318555086849", - "updated_at": "2022-03-15T20:31:40Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - } - ] - } - \ No newline at end of file diff --git a/tests/fixtures/cards_load.json b/tests/fixtures/cards_load.json deleted file mode 100644 index 502f874..0000000 --- a/tests/fixtures/cards_load.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "request": { - "params": { - "account_id": "2iqph", - "card_id": "1503831318555086849" - } - }, - "data": { - "name": "my new card", - "components": [ - { - "media_key": "13_794652834998325248", - "media_metadata": { - "13_794652834998325248": { - "type": "VIDEO", - "url": "https://video.twimg.com/amplify_video/794652834998325248/vid/640x360/pUgE2UKcfPwF_5Uh.mp4", - "width": 640, - "height": 360, - "video_duration": 7967, - "video_aspect_ratio": "16:9" - } - }, - "type": "MEDIA" - }, - { - "title": "Twitter", - "destination": { - "url": "http://twitter.com/login", - "type": "WEBSITE" - }, - "type": "DETAILS" - } - ], - "id": "1503831318555086849", - "created_at": "2022-03-15T20:31:40Z", - "card_uri": "card://1503831318555086849", - "updated_at": "2022-03-15T20:31:40Z", - "deleted": false, - "card_type": "VIDEO_WEBSITE" - } - } - \ No newline at end of file diff --git a/tests/fixtures/custom_audiences_all.json b/tests/fixtures/custom_audiences_all.json deleted file mode 100644 index 53ca653..0000000 --- a/tests/fixtures/custom_audiences_all.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "request": { - "params": { - "account_id": "2iqph" - } - }, - "data": [ - { - "targetable": false, - "name": "TA #2", - "targetable_types": [ - "WEB", - "EXCLUDED_WEB" - ], - "audience_type": "WEB", - "id": "abc2", - "owner_account_id": "2iqph", - "reasons_not_targetable": [ - "TOO_SMALL" - ], - "list_type": null, - "created_at": "2014-03-09T20:35:41Z", - "updated_at": "2014-06-11T09:38:06Z", - "partner_source": "OTHER", - "deleted": false, - "audience_size": null - }, - { - "targetable": true, - "name": "TA #1", - "owner_account_id": "2iqph", - "targetable_types": [ - "CRM", - "EXCLUDED_CRM" - ], - "audience_type": "CRM", - "id": "abc1", - "reasons_not_targetable": [], - "list_type": "DEVICE_ID", - "created_at": "2014-05-22T17:37:12Z", - "updated_at": "2014-05-22T21:05:33Z", - "partner_source": "OTHER", - "deleted": false, - "audience_size": null - }, - { - "targetable": false, - "name": "TA #3", - "owner_account_id": "2iqph", - "targetable_types": [ - "CRM", - "EXCLUDED_CRM" - ], - "audience_type": "CRM", - "id": "abc3", - "reasons_not_targetable": [ - "TOO_SMALL" - ], - "list_type": "EMAIL", - "created_at": "2014-05-22T21:43:45Z", - "updated_at": "2014-05-23T02:27:31Z", - "partner_source": "OTHER", - "deleted": false, - "audience_size": null - } - ], - "total_count": 3, - "next_cursor": null -} diff --git a/tests/fixtures/custom_audiences_load.json b/tests/fixtures/custom_audiences_load.json deleted file mode 100644 index 0d143ba..0000000 --- a/tests/fixtures/custom_audiences_load.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data_type": "custom_audience", - "data": { - "targetable": false, - "name": "TA #2", - "targetable_types": [ - "WEB", - "EXCLUDED_WEB" - ], - "audience_type": "WEB", - "id": "abc2", - "reasons_not_targetable": [ - "TOO_SMALL" - ], - "list_type": null, - "created_at": "2014-03-09T20:35:41Z", - "updated_at": "2014-06-11T09:38:06Z", - "partner_source": "OTHER", - "deleted": false, - "audience_size": null - }, - "request": { - "params": { - "account_id": "2iqph", - "name": "TA #2", - "list_type": "EMAIL" - } - } -} diff --git a/tests/fixtures/custom_audiences_permissions_all.json b/tests/fixtures/custom_audiences_permissions_all.json deleted file mode 100644 index 98dd7ed..0000000 --- a/tests/fixtures/custom_audiences_permissions_all.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "request": { - "params": { - "account_id": "2iqph", - "custom_audience_id": "abc2" - } - }, - "data": [ - { - "custom_audience_id": "abc2", - "permission_level": "READ_ONLY", - "id": "k", - "created_at": "2016-04-09T18:16:32Z", - "granted_account_id": "pz6ec", - "updated_at": "2016-04-10T15:07:38Z", - "deleted": false - }, - { - "custom_audience_id": "abc2", - "permission_level": "READ_ONLY", - "id": "l", - "created_at": "2016-04-09T18:22:33Z", - "granted_account_id": "j9ozo", - "updated_at": "2016-04-09T18:22:33Z", - "deleted": false - } - ], - "data_type": "custom_audience_permission", - "total_count": 2, - "next_cursor": null -} diff --git a/tests/fixtures/funding_instruments_all.json b/tests/fixtures/funding_instruments_all.json deleted file mode 100644 index 3a6ea76..0000000 --- a/tests/fixtures/funding_instruments_all.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "request": { - "params": { - "funding_instrument_ids": [ - "7cdql", "5aa0p", "dhuk2" - ], - "account_id": "2iqph" - } - }, - "data": [ - { - "start_time": "2015-08-25T09:18:19Z", - "description": "Denesik, O'Reilly and Zulauf", - "credit_limit_local_micro": null, - "end_time": "2017-02-28T08:15:40Z", - "cancelled": false, - "id": "5aa0p", - "paused": false, - "account_id": "2iqph", - "reasons_not_able_to_fund": [], - "currency": "USD", - "funded_amount_local_micro": 5000000000, - "created_at": "2015-08-19T01:35:10Z", - "type": "INSERTION_ORDER", - "able_to_fund": false, - "updated_at": "2015-08-19T01:35:10Z", - "credit_remaining_local_micro": null, - "deleted": false - }, - { - "start_time": "2011-07-11T07:00:00Z", - "description": "Simonis-Barton", - "credit_limit_local_micro": null, - "end_time": "2012-07-12T06:59:59Z", - "cancelled": false, - "id": "7cdql", - "paused": false, - "account_id": "2iqph", - "reasons_not_able_to_fund": [ - "EXPIRED" - ], - "currency": "USD", - "funded_amount_local_micro": 5000000000, - "created_at": "2011-07-11T17:33:01Z", - "type": "INSERTION_ORDER", - "able_to_fund": false, - "updated_at": "2012-01-18T19:19:56Z", - "credit_remaining_local_micro": null, - "deleted": false - }, - { - "start_time": "2015-08-25T09:18:19Z", - "description": "Farrell Group", - "credit_limit_local_micro": 5000000000, - "end_time": "2017-02-28T08:15:40Z", - "cancelled": false, - "id": "dhuk2", - "paused": false, - "account_id": "2iqph", - "reasons_not_able_to_fund": [], - "currency": "USD", - "funded_amount_local_micro": null, - "created_at": "2015-08-19T01:35:10Z", - "type": "CREDIT_LINE", - "able_to_fund": false, - "updated_at": "2015-08-19T01:35:10Z", - "credit_remaining_local_micro": null, - "deleted": false - } - ], - "data_type": "funding_instrument", - "total_count": 3, - "next_cursor": null -} diff --git a/tests/fixtures/funding_instruments_load.json b/tests/fixtures/funding_instruments_load.json deleted file mode 100644 index c2bae07..0000000 --- a/tests/fixtures/funding_instruments_load.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "data_type": "funding_instrument", - "data": { - "start_time": "2015-08-25T09:18:19Z", - "description": "Denesik, O'Reilly and Zulauf", - "credit_limit_local_micro": null, - "end_time": "2017-02-28T08:15:40Z", - "cancelled": false, - "id": "5aa0p", - "paused": false, - "account_id": "2iqph", - "reasons_not_able_to_fund": [], - "currency": "USD", - "funded_amount_local_micro": 5000000000, - "created_at": "2015-08-19T01:35:10Z", - "type": "INSERTION_ORDER", - "able_to_fund": false, - "updated_at": "2015-08-19T01:35:10Z", - "credit_remaining_local_micro": null, - "deleted": false - }, - "request": { - "params": { - "funding_instrument_id": "5aa0p", - "account_id": "2iqph" - } - } -} diff --git a/tests/fixtures/line_items_all.json b/tests/fixtures/line_items_all.json deleted file mode 100644 index a886d6c..0000000 --- a/tests/fixtures/line_items_all.json +++ /dev/null @@ -1,262 +0,0 @@ -{ - "request": { - "params": { - "account_id": "2iqph" - } - }, - "data": [ - { - "placement_type": "PROMOTED_ACCOUNT", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "ALL_ON_TWITTER" - ], - "bid_amount_local_micro": 2000000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_ACCOUNT", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "bw2", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "USD", - "created_at": "2011-07-11T20:36:11Z", - "updated_at": "2011-09-04T19:39:51Z", - "campaign_id": "2wap7", - "deleted": false - }, - { - "placement_type": "PROMOTED_ACCOUNT", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "ALL_ON_TWITTER" - ], - "bid_amount_local_micro": 2000000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_ACCOUNT", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "c4m", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "USD", - "created_at": "2011-07-13T20:56:39Z", - "updated_at": "2011-09-04T19:39:04Z", - "campaign_id": "2wamv", - "deleted": false - }, - { - "placement_type": "PROMOTED_TWEETS_FOR_SEARCH", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "TWITTER_SEARCH" - ], - "bid_amount_local_micro": 100000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_TWEETS", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "c5c", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "USD", - "created_at": "2011-07-14T00:04:47Z", - "updated_at": "2011-09-04T19:39:39Z", - "campaign_id": "2wai9", - "deleted": false - }, - { - "placement_type": "PROMOTED_TWEETS_FOR_SEARCH", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "TWITTER_SEARCH" - ], - "bid_amount_local_micro": 500000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_TWEETS", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "fhu", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "USD", - "created_at": "2011-08-22T22:42:18Z", - "updated_at": "2011-09-04T19:40:02Z", - "campaign_id": "2of1n", - "deleted": false - }, - { - "placement_type": "PROMOTED_TWEETS_FOR_TIMELINES", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "TWITTER_TIMELINE" - ], - "bid_amount_local_micro": 50000000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_TWEETS", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "fxd", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "JPY", - "created_at": "2011-08-26T20:51:14Z", - "updated_at": "2011-08-26T21:30:25Z", - "campaign_id": "2w9n1", - "deleted": true - }, - { - "placement_type": "PROMOTED_TWEETS_FOR_TIMELINES", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "TWITTER_TIMELINE" - ], - "bid_amount_local_micro": 50000000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_TWEETS", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "fxt", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "USD", - "created_at": "2011-08-26T21:38:51Z", - "updated_at": "2011-08-26T22:24:37Z", - "campaign_id": "2vuug", - "deleted": true - }, - { - "placement_type": "PROMOTED_TWEETS_FOR_SEARCH", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "TWITTER_SEARCH" - ], - "bid_amount_local_micro": 50000000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_TWEETS", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "fya", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "JPY", - "created_at": "2011-08-26T22:28:55Z", - "updated_at": "2011-09-04T19:38:46Z", - "campaign_id": "2vuj3", - "deleted": false - }, - { - "placement_type": "PROMOTED_TWEETS_FOR_TIMELINES", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "TWITTER_TIMELINE" - ], - "bid_amount_local_micro": 500000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_TWEETS", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "ghj", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "USD", - "created_at": "2011-09-01T17:25:04Z", - "updated_at": "2011-09-16T02:56:55Z", - "campaign_id": "2v3c4", - "deleted": true - }, - { - "placement_type": "PROMOTED_TWEETS_FOR_SEARCH", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "TWITTER_SEARCH" - ], - "bid_amount_local_micro": 50000000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_TWEETS", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "gra", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "JPY", - "created_at": "2011-09-06T17:42:52Z", - "updated_at": "2011-09-30T18:54:18Z", - "campaign_id": "2ttv3", - "deleted": false - }, - { - "placement_type": "PROMOTED_TWEETS_FOR_TIMELINES", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "TWITTER_TIMELINE" - ], - "bid_amount_local_micro": 2009999, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_TWEETS", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "gsw", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "USD", - "created_at": "2011-09-06T22:44:13Z", - "updated_at": "2011-09-20T01:32:27Z", - "campaign_id": "2ttv3", - "deleted": true - } - ], - "data_type": "line_item", - "total_count": 10, - "next_cursor": null -} diff --git a/tests/fixtures/line_items_load.json b/tests/fixtures/line_items_load.json deleted file mode 100644 index b5607d3..0000000 --- a/tests/fixtures/line_items_load.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "data_type": "line_item", - "data": { - "placement_type": "PROMOTED_ACCOUNT", - "bid_strategy": "MAX", - "name": "Untitled", - "placements": [ - "ALL_ON_TWITTER" - ], - "bid_amount_local_micro": 2000000, - "advertiser_domain": null, - "primary_web_event_tag": null, - "pay_by": "ENGAGEMENT", - "product_type": "PROMOTED_ACCOUNT", - "total_budget_amount_local_micro": null, - "objective": "CUSTOM", - "id": "bw2", - "entity_status": "ACTIVE", - "account_id": "2iqph", - "goal": null, - "categories": [], - "currency": "USD", - "created_at": "2011-07-11T20:36:11Z", - "updated_at": "2011-09-04T19:39:51Z", - "campaign_id": "2wap7", - "deleted": false - }, - "request": { - "params": { - "account_id": "2iqph" - } - } -} diff --git a/tests/fixtures/placements.json b/tests/fixtures/placements.json deleted file mode 100644 index 6e10080..0000000 --- a/tests/fixtures/placements.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "data_type": "placement", - "data": [ - { - "product_type": "PROMOTED_TWEETS", - "placements": [ - [ - "ALL_ON_TWITTER" - ], - [ - "ALL_ON_TWITTER", - "PUBLISHER_NETWORK" - ], - [ - "PUBLISHER_NETWORK" - ], - [ - "PUBLISHER_NETWORK", - "TWITTER_TIMELINE" - ], - [ - "TWITTER_SEARCH" - ], - [ - "TWITTER_TIMELINE" - ] - ] - } - ], - "request": { - "params": { - "product_type": "PROMOTED_TWEETS" - } - } -} diff --git a/tests/fixtures/promotable_users_all.json b/tests/fixtures/promotable_users_all.json deleted file mode 100644 index 7494070..0000000 --- a/tests/fixtures/promotable_users_all.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "request": { - "params": { - "account_id": "2iqph" - } - }, - "data": [ - { - "user_id": "330677333", - "id": "4k", - "account_id": "2iqph", - "created_at": "2011-11-14T21:26:54Z", - "updated_at": "2014-07-30T23:49:23Z", - "deleted": false, - "promotable_user_type": "FULL" - }, - { - "user_id": "154303893", - "id": "5ze", - "account_id": "2iqph", - "created_at": "2012-04-23T16:02:08Z", - "updated_at": "2014-05-20T19:07:17Z", - "deleted": false, - "promotable_user_type": "RETWEETS_ONLY" - }, - { - "user_id": "16088304", - "id": "2jbq3", - "account_id": "2iqph", - "created_at": "2013-08-21T10:31:01Z", - "updated_at": "2014-05-20T12:35:01Z", - "deleted": false, - "promotable_user_type": "RETWEETS_ONLY" - }, - { - "user_id": "14216557", - "id": "2jlym", - "account_id": "2iqph", - "created_at": "2013-09-04T22:36:24Z", - "updated_at": "2014-05-20T20:09:11Z", - "deleted": false, - "promotable_user_type": "RETWEETS_ONLY" - }, - { - "user_id": "312226591", - "id": "2kuyo", - "account_id": "2iqph", - "created_at": "2013-09-12T22:59:10Z", - "updated_at": "2014-05-22T14:36:22Z", - "deleted": false, - "promotable_user_type": "RETWEETS_ONLY" - } - ], - "data_type": "promotable_user", - "total_count": 5, - "next_cursor": null -} diff --git a/tests/fixtures/promotable_users_load.json b/tests/fixtures/promotable_users_load.json deleted file mode 100644 index c45db25..0000000 --- a/tests/fixtures/promotable_users_load.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "request": { - "params": { - "promotable_user_id": "4k", - "account_id": "2iqph" - } - }, - "data_type": "promotable_user", - "data": { - "user_id": "330677333", - "id": "4k", - "account_id": "2iqph", - "created_at": "2011-11-14T21:26:54Z", - "updated_at": "2014-07-30T23:49:23Z", - "deleted": false, - "promotable_user_type": "FULL" - } -} diff --git a/tests/fixtures/promoted_tweets_all.json b/tests/fixtures/promoted_tweets_all.json deleted file mode 100644 index e2ef5dd..0000000 --- a/tests/fixtures/promoted_tweets_all.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "request": { - "params": { - "account_id": "2iqph" - } - }, - "data": [ - { - "line_item_id": "2b7xw", - "id": "6thl4", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "585127452231467008", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thl3", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "586731999949230081", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thl5", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "583313515869544448", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thl6", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "583081704308396032", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thl7", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "583073876369903616", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thl8", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "582367545145065472", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thlb", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "577486751108853760", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thle", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "567096999225622529", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thlf", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "558306878145695744", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thlg", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "556576716651778048", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thlh", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "554808298604883968", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thln", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "541420699643285506", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thlo", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "540630410880110592", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thlp", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "539985554486878208", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6thlq", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "536352096103432193", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6tt7l", - "entity_status": "ACTIVE", - "created_at": "2015-04-12T23:47:44Z", - "updated_at": "2015-04-12T23:47:44Z", - "approval_status": "ACCEPTED", - "tweet_id": "587383478448218112", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6tt7m", - "entity_status": "ACTIVE", - "created_at": "2015-04-12T23:47:44Z", - "updated_at": "2015-04-12T23:47:44Z", - "approval_status": "ACCEPTED", - "tweet_id": "587292858576666625", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6ugv1", - "entity_status": "ACTIVE", - "created_at": "2015-04-13T22:19:08Z", - "updated_at": "2015-04-13T22:19:08Z", - "approval_status": "ACCEPTED", - "tweet_id": "587741638593753089", - "deleted": false - }, - { - "line_item_id": "2b7xw", - "id": "6w7b5", - "entity_status": "ACTIVE", - "created_at": "2015-04-16T17:01:56Z", - "updated_at": "2015-04-16T17:01:56Z", - "approval_status": "ACCEPTED", - "tweet_id": "588719630467915777", - "deleted": false - }, - { - "line_item_id": "2dw80", - "id": "70dbj", - "entity_status": "ACTIVE", - "created_at": "2015-04-23T20:27:27Z", - "updated_at": "2015-04-23T20:27:27Z", - "approval_status": "ACCEPTED", - "tweet_id": "591337582350376961", - "deleted": false - } - ], - "data_type": "promoted_tweet", - "total_count": 20, - "next_cursor": null -} diff --git a/tests/fixtures/promoted_tweets_attach.json b/tests/fixtures/promoted_tweets_attach.json deleted file mode 100644 index 29f7101..0000000 --- a/tests/fixtures/promoted_tweets_attach.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "data_type": "promoted_tweet", - "data": [ - { - "line_item_id": "2b7xw", - "id": "6thl4", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "585127452231467008", - "deleted": false - } - ], - "request": { - "params": { - "line_item_id": "2b7xw", - "tweet_ids": [ - 585127452231467008 - ], - "account_id": "2iqph" - } - }, - "total_count": 1 -} diff --git a/tests/fixtures/promoted_tweets_load.json b/tests/fixtures/promoted_tweets_load.json deleted file mode 100644 index 51864f2..0000000 --- a/tests/fixtures/promoted_tweets_load.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "data_type": "promoted_tweet", - "data": { - "line_item_id": "2b7xw", - "id": "6thl4", - "entity_status": "ACTIVE", - "created_at": "2015-04-11T20:50:25Z", - "updated_at": "2015-04-11T20:50:25Z", - "approval_status": "ACCEPTED", - "tweet_id": "585127452231467008", - "deleted": false - }, - "request": { - "params": { - "promoted_tweet_id": "6thl4", - "account_id": "2iqph" - } - } -} diff --git a/tests/fixtures/reach_estimate.json b/tests/fixtures/reach_estimate.json deleted file mode 100644 index 557e82d..0000000 --- a/tests/fixtures/reach_estimate.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "data_type": "reach_estimate", - "data": { - "impressions": { - "min": 285, - "max": 428 - }, - "count": { - "min": 232, - "max": 349 - }, - "infinite_bid_count": { - "min": 1638, - "max": 2457 - }, - "engagements": { - "min": 7, - "max": 11 - }, - "estimated_daily_spend_local_micro": { - "min": 440000, - "max": 660000 - } - }, - "request": { - "params": { - "bid_amount_local_micro": 150000, - "similar_to_followers_of_users": [ - 14230524, - 90420314 - ], - "product_type": "PROMOTED_TWEETS", - "objective": "TWEET_ENGAGEMENTS", - "account_id": "2iqph", - "currency": "USD", - "followers_of_users": null, - "campaign_daily_budget_amount_local_micro": 550000 - } - } -} diff --git a/tests/fixtures/tailored_audiences_load.json b/tests/fixtures/tailored_audiences_load.json deleted file mode 100644 index 02d822f..0000000 --- a/tests/fixtures/tailored_audiences_load.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data_type": "tailored_audience", - "data": { - "targetable": false, - "name": "TA #2", - "targetable_types": [ - "WEB", - "EXCLUDED_WEB" - ], - "audience_type": "WEB", - "id": "abc2", - "reasons_not_targetable": [ - "TOO_SMALL" - ], - "list_type": null, - "created_at": "2014-03-09T20:35:41Z", - "updated_at": "2014-06-11T09:38:06Z", - "partner_source": "OTHER", - "deleted": false, - "audience_size": null - }, - "request": { - "params": { - "account_id": "2iqph", - "name": "TA #2", - "list_type": "EMAIL" - } - } -} diff --git a/tests/fixtures/targeted_audiences.json b/tests/fixtures/targeted_audiences.json deleted file mode 100644 index 0b71100..0000000 --- a/tests/fixtures/targeted_audiences.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "request": { - "params": { - "account_id": "2iqph", - "tailored_audience_id": "abc2" - } - }, - "next_cursor": null, - "data": [ - { - "campaign_id": "59hod", - "campaign_name": "test-campaign", - "line_items": [ - { - "id": "5gzog", - "name": "test-line-item", - "servable": true - } - ] - }, - { - "campaign_id": "arja7", - "campaign_name": "Untitled campaign", - "line_items": [ - { - "id": "bjw1q", - "name": null, - "servable": true - } - ] - } - ] -} \ No newline at end of file diff --git a/tests/fixtures/tweet_previews.json b/tests/fixtures/tweet_previews.json deleted file mode 100644 index fcc1dfb..0000000 --- a/tests/fixtures/tweet_previews.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "data_type": "tweet_previews", - "request": { - "params": { - "tweet_ids": [ - "1130942781109596160", - "1101254234031370240" - ], - "tweet_type": "PUBLISHED", - "account_id": "2iqph" - } - }, - "data": [ - { - "tweet_id": "1130942781109596160", - "preview": "