File: _init_environment.py

package info (click to toggle)
python-boto 2.49.0-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,888 kB
  • sloc: python: 86,396; makefile: 112
file content (28 lines) | stat: -rw-r--r-- 934 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import functools

live_connection = False
mturk_host = 'mechanicalturk.sandbox.amazonaws.com'
external_url = 'http://www.example.com/'


SetHostMTurkConnection = None

def config_environment():
    global SetHostMTurkConnection
    try:
            local = os.path.join(os.path.dirname(__file__), 'local.py')
            execfile(local)
    except:
            pass

    if live_connection:
            #TODO: you must set the auth credentials to something valid
            from boto.mturk.connection import MTurkConnection
    else:
            # Here the credentials must be set, but it doesn't matter what
            #  they're set to.
            os.environ.setdefault('AWS_ACCESS_KEY_ID', 'foo')
            os.environ.setdefault('AWS_SECRET_ACCESS_KEY', 'bar')
            from mocks import MTurkConnection
    SetHostMTurkConnection = functools.partial(MTurkConnection, host=mturk_host)