Skip to content

Commit

Permalink
Updated versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Belodedenko committed Apr 7, 2016
1 parent 3dff485 commit cf61e73
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,5 @@ If you find this useful, please feel free to make a small donation with [PayPal]
[n13] See, [IPv6 on Amazon AWS EC2](http://blog.iphoting.com/blog/2012/06/02/ipv6-on-amazon-aws-ec2/).

```
-- v2.3
-- v2.4
```
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [[ $(infocmp | grep 'hpa=') == "" ]]; then
fi

# gobals
VERSION=2.3
VERSION=2.4
TIMEOUT=10
BUILD_ROOT=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
SDNS_ADMIN_PORT=43867
Expand Down
18 changes: 14 additions & 4 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@
"""Default options for the application.
"""

VERSION = '0.1' # current version
DEFAULT_PROXY = None # proxy (e.g. 'localhost:8080')
VERSION = '2.4' # current version
BASE_API_URL = 'https://api.digitalocean.com/v2'
DEFAULT_PROXY = None # proxy URL (e.g. 'localhost:8080')
DEFAULT_HOST = 'www.netflix.com' # default Netflix host
DEFAULT_TITLEID = 80001898 # '1000 Times good Night'
DEFAULT_PLAYBACK = 60 # number of seconds to play video
DEFAULT_TIMEOUT = 10 # default operation timeout in seconds
DEFAULT_TRIES = 3 # exponential back-off retry
DEFAULT_DELAY = 10 # exponential back-off delay
DEFAULT_TRIES = 4 # exponential back-off retry
DEFAULT_DELAY = 30 # exponential back-off delay
DEFAULT_BACKOFF = 2 # exponential back-off
DOCKER_IMAGE_SLUG = 'docker'
DEFAULT_FINGERPRINT = ['d1:b6:92:ea:cc:4c:fe:9c:c5:ef:27:ce:33:1f:ba:61']
DEFAULT_REGION_SLUG = 'nyc3'
DEFAULT_MEMORY_SIZE_SLUG = '512mb'
DEFAULT_VCPUS = 1
DEFAULT_DISK_SIZE = 20
DEFAULT_SLEEP = 5
DEFAULT_BRANCH = 'master'
DEFAULT_HE_TB_INDEX = 1
45 changes: 23 additions & 22 deletions tests/testbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,23 @@
stderr.write('ERROR: Python module "OpenSSL" not found, please run "pip install pyopenssl".\n')
exit(1)


PROXY_HOST = None
PROXY_PORT = None
BASE_API_URL = 'https://api.digitalocean.com/v2'
DOCKER_IMAGE_SLUG = 'docker'
DEFAULT_FINGERPRINT = ['d1:b6:92:ea:cc:4c:fe:9c:c5:ef:27:ce:33:1f:ba:61']
DEFAULT_REGION_SLUG = 'nyc3'
DEFAULT_MEMORY_SIZE_SLUG = '512mb'
DEFAULT_VCPUS = 1
DEFAULT_DISK_SIZE = 20
DEFAULT_SLEEP = 5
DEFAULT_BRANCH = 'master'
DEFAULT_HE_TB_INDEX = 1
DEFAULT_TRIES = 4
DEFAULT_DELAY = 30
DEFAULT_BACKOFF = 2
from settings import (VERSION,
DEFAULT_PROXY,
BASE_API_URL,
DEFAULT_HOST,
DOCKER_IMAGE_SLUG,
DEFAULT_FINGERPRINT,
DEFAULT_REGION_SLUG,
DEFAULT_MEMORY_SIZE_SLUG,
DEFAULT_VCPUS,
DEFAULT_DISK_SIZE,
DEFAULT_SLEEP,
DEFAULT_BRANCH,
DEFAULT_HE_TB_INDEX,
DEFAULT_TRIES,
DEFAULT_DELAY,
DEFAULT_BACKOFF,
DEFAULT_TITLEID)


def retry(ExceptionToCheck, tries=DEFAULT_TRIES, delay=DEFAULT_DELAY, backoff=DEFAULT_BACKOFF, cdata=None):
Expand Down Expand Up @@ -107,7 +108,7 @@ def get_regions(s):

def args():
parser = argparse.ArgumentParser()
sp = parser.add_subparsers()
sp = parser.add_subparsers(help='version %s' % VERSION)
digitalocean = sp.add_parser('digitalocean')
digitalocean.add_argument('provider', action='store_const', const='digitalocean', help=argparse.SUPPRESS)
digitalocean.add_argument('--api_token', type=str, required=True, help='DigitalOcean API v2 secret token')
Expand Down Expand Up @@ -288,7 +289,7 @@ def netflix_proxy_test_retry(ip):
return netflix_proxy_test_retry(ip)


def netflix_openssl_test(ip=None, port=443, hostname='netflix.com'):
def netflix_openssl_test(ip=None, port=443, hostname=DEFAULT_HOST):
"""
Connect to an SNI-enabled server and request a specific hostname
"""
Expand Down Expand Up @@ -319,7 +320,7 @@ def netflix_openssl_test_retry(ip):
return netflix_openssl_test_retry(ip)


def netflix_test(ip=None, host='www.netflix.com'):
def netflix_test(ip=None, host=DEFAULT_HOST):

@retry(Exception, tries=3, delay=10, backoff=2, cdata='method=%s()' % inspect.stack()[0][3])
def netflix_openssl_test_retry(ip):
Expand Down Expand Up @@ -367,10 +368,10 @@ def get_sysdns():

droplet_id = None
s = requests.Session()
if PROXY_HOST and PROXY_PORT:
if DEFAULT_PROXY:
s.verify = False
s.proxies = {'http' : 'http://%s:%s' % (PROXY_HOST, PROXY_PORT),
'https': 'https://%s:%s' % (PROXY_HOST, PROXY_PORT)}
s.proxies = {'http' : 'http://%s' % DEFAULT_PROXY,
'https': 'https://%s' % DEFAULT_PROXY}
s.headers.update({'Authorization': 'Bearer %s' % arg.api_token})

if arg.list_regions:
Expand Down
9 changes: 4 additions & 5 deletions tests/testvideo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env python

"""
Version : 1.0
Automatically play back Netflix titles.
Uses Selenium Python bindings for WebDriver.
Expand All @@ -19,7 +17,8 @@
from functools import wraps
from pprint import pprint

from settings import (DEFAULT_PROXY,
from settings import (VERSION,
DEFAULT_PROXY,
DEFAULT_HOST,
DEFAULT_PLAYBACK,
DEFAULT_TIMEOUT,
Expand Down Expand Up @@ -53,14 +52,14 @@

def args():
parser = argparse.ArgumentParser()
sp = parser.add_subparsers()
sp = parser.add_subparsers(help='version %s' % VERSION)
netflix = sp.add_parser('netflix')
netflix.add_argument('provider', action='store_const', const='netflix', help=argparse.SUPPRESS)
netflix.add_argument('--email', type=str, required=True, help='Netflix username')
netflix.add_argument('--password', type=str, required=True, help='Netflix password')
netflix.add_argument('--seconds', type=int, default=DEFAULT_PLAYBACK, help='playback time per title in seconds (default: %i)' % DEFAULT_PLAYBACK)
netflix.add_argument('--titleid', type=int, default=DEFAULT_TITLEID, help='Netflix title_id to play (default: %i)' % DEFAULT_TITLEID)
netflix.add_argument('--tries', type=int, default=DEFAULT_TRIES, help='Playback restart attempts (default: %i)' % DEFAULT_TRIES)
netflix.add_argument('--tries', type=int, default=DEFAULT_TRIES, help='Playback restart attempts (default: %i)' % DEFAULT_TRIES)
hulu = sp.add_parser('hulu')
hulu.add_argument('provider', action='store_const', const='hulu', help=argparse.SUPPRESS)
args = parser.parse_args()
Expand Down

0 comments on commit cf61e73

Please sign in to comment.