Python API Client for Traffic Ops
Project description
- Introduction
This directory contains the Traffic Ops Python Client for Python 2.x and Python 3.x.
NOTE: This client has only been tested against Python 2.7 and Python 3.6. Other versions
may work, so, you mileage may vary.
- Installation
NOTE: Assuming in a already newly created and activated virtualenv
From github.com via pip:
# pip install git+https://github.com/apache/trafficcontrol.git#"egg=trafficops&subdirectory=traffic_control/clients/python/trafficops"
or
# pip install git+ssh://git@github.com/apache/trafficcontrol.git#"egg=trafficops&subdirectory=traffic_control/clients/python/trafficops"
Local Installation from cloned 'trafficcontrol' repository:
NOTE: 'trafficcontrol' => https://www.github.com/apache/trafficcontrol
NOTE: Assuming cd'd to the root of a forked/cloned 'trafficcontrol' repository
1. Activate your virtualenv environment (Python Virtual Environment)
E.g.
NOTE: Where <virtual environment directory> is, for example, '~/VENV/my_venv'.
$ source ~/VENV/my_venv/bin/activate
(my_venv) $
2. Install the software for the correct environment in the activated virtualenv
(my_venv) $ cd <root of 'trafficcontrol' repository>/traffic_control/clients/python/trafficops
(my_venv) $ python setup.py install
...
(my_venv) $ cd <root of 'trafficcontrol' repository>
3. Test Package is installed correctly
(my_venv) $ python
(my_venv) $ Python 3.6.1 (default, Apr 4 2017, 09:40:21)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import trafficops
>>> dir(trafficops)
['LoginError', 'OperationError', 'RestApiSession', 'TOSession', '__builtins__', '__cached__',
'__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__',
'__version__', 'api_request', 'default_headers', 'restapi', 'tosession']
>>> tos = trafficops.TOSession(host_ip=u'to.somedomain.net', verify_cert=True)
>>> tos.login(u'someuser', u'someuser123')
>>> cdns, response = tos.get_cdns()
>>> exit()
(my_venv) $
NOTE: No errors/exceptions (warnings are okay) means you should be good to go.
This directory contains the Traffic Ops Python Client for Python 2.x and Python 3.x.
NOTE: This client has only been tested against Python 2.7 and Python 3.6. Other versions
may work, so, you mileage may vary.
- Installation
NOTE: Assuming in a already newly created and activated virtualenv
From github.com via pip:
# pip install git+https://github.com/apache/trafficcontrol.git#"egg=trafficops&subdirectory=traffic_control/clients/python/trafficops"
or
# pip install git+ssh://git@github.com/apache/trafficcontrol.git#"egg=trafficops&subdirectory=traffic_control/clients/python/trafficops"
Local Installation from cloned 'trafficcontrol' repository:
NOTE: 'trafficcontrol' => https://www.github.com/apache/trafficcontrol
NOTE: Assuming cd'd to the root of a forked/cloned 'trafficcontrol' repository
1. Activate your virtualenv environment (Python Virtual Environment)
E.g.
NOTE: Where <virtual environment directory> is, for example, '~/VENV/my_venv'.
$ source ~/VENV/my_venv/bin/activate
(my_venv) $
2. Install the software for the correct environment in the activated virtualenv
(my_venv) $ cd <root of 'trafficcontrol' repository>/traffic_control/clients/python/trafficops
(my_venv) $ python setup.py install
...
(my_venv) $ cd <root of 'trafficcontrol' repository>
3. Test Package is installed correctly
(my_venv) $ python
(my_venv) $ Python 3.6.1 (default, Apr 4 2017, 09:40:21)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import trafficops
>>> dir(trafficops)
['LoginError', 'OperationError', 'RestApiSession', 'TOSession', '__builtins__', '__cached__',
'__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__',
'__version__', 'api_request', 'default_headers', 'restapi', 'tosession']
>>> tos = trafficops.TOSession(host_ip=u'to.somedomain.net', verify_cert=True)
>>> tos.login(u'someuser', u'someuser123')
>>> cdns, response = tos.get_cdns()
>>> exit()
(my_venv) $
NOTE: No errors/exceptions (warnings are okay) means you should be good to go.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for Apache-TrafficControl-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aff0e2257ee24e4e791523c1d5a80adaa1fd92f8c6f0e2c75a1dffcd4fc80dd9 |
|
MD5 | 88d0d67ccef7bf417627b35c0f3eca6a |
|
BLAKE2b-256 | d55c03e58f8897489c0c29b50d7010f9ffbf21c5390a0811f903b6080422fbaf |
Close
Hashes for Apache_TrafficControl-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c235fa3d5a3158c05e472455b97e3e7d5f05da78e5eb32c02c010c7a05444781 |
|
MD5 | 787e5231860f6f1a1d62d82c40ed2b30 |
|
BLAKE2b-256 | 500e70bb5eb22457c08eb778760879c1a449e46baf9b1d118418903b73c6cbc4 |