aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws/core.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-05-13 09:11:45 +0300
committerFilipp Lepalaan <f@230.to>2013-05-13 09:11:45 +0300
commit54331c8677c35449809524154fcde1fed7c84c42 (patch)
treee68f46b62ff17aae780f4dee6ad7c1038f975082 /gsxws/core.py
parentc0eb64d41e921cf4ee3498d89591f5464c76eee7 (diff)
downloadpy-gsxws-54331c8677c35449809524154fcde1fed7c84c42.tar.gz
py-gsxws-54331c8677c35449809524154fcde1fed7c84c42.tar.bz2
py-gsxws-54331c8677c35449809524154fcde1fed7c84c42.zip
Better imports
Diffstat (limited to 'gsxws/core.py')
-rw-r--r--gsxws/core.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/gsxws/core.py b/gsxws/core.py
index c2b0aba..2b4b7be 100644
--- a/gsxws/core.py
+++ b/gsxws/core.py
@@ -36,11 +36,21 @@ import xml.etree.ElementTree as ET
from datetime import date, time, datetime, timedelta
-GSX_ENV = "it"
-GSX_LANG = "en"
-GSX_REGION = "emea"
-GSX_LOCALE = "en_XXX"
-GSX_SESSION = None
+GSX_ENV = "it"
+GSX_LANG = "en"
+GSX_REGION = "emea"
+GSX_LOCALE = "en_XXX"
+
+GSX_SESSION = None
+
+GSX_REGIONS = (
+ ('002', "Asia/Pacific"),
+ ('003', "Japan"),
+ ('004', "Europe"),
+ ('005', "United States"),
+ ('006', "Canadia"),
+ ('007', "Latin America"),
+)
GSX_TIMEZONES = (
('GMT', "UTC (Greenwich Mean Time)"),
@@ -62,15 +72,6 @@ GSX_TIMEZONES = (
('NZST', "UTC + 12h (New Zealand Standard Time)"),
)
-GSX_REGIONS = (
- ('002', "Asia/Pacific"),
- ('003', "Japan"),
- ('004', "Europe"),
- ('005', "United States"),
- ('006', "Canadia"),
- ('007', "Latin America"),
-)
-
REGION_CODES = ('apac', 'am', 'la', 'emea',)
ENVIRONMENTS = (
@@ -144,11 +145,11 @@ class GsxCache(object):
"""
shelf = None
tmpdir = tempfile.gettempdir()
- expires = timedelta(minutes=20)
filename = os.path.join(tmpdir, "gsxws.tmp")
- def __init__(self, key):
+ def __init__(self, key, expires=timedelta(minutes=20)):
self.key = key
+ self.expires = expires
self.shelf = shelve.open(self.filename, protocol=-1)
self.now = datetime.now()