Exemple #1
0
# coding: utf8
# caching.py
# 8/12/2013 jichi

__all__ = 'CachingRestApi', 'CachingSoftApi'

if __name__ == '__main__': # DEBUG
  import sys
  sys.path.append("..")

from restful.offline import DataCacher, FileCacher
from rest import RestApi
from soft import SoftApi

CachingSoftApi = DataCacher(SoftApi, suffix='.html')
CachingRestApi = FileCacher(RestApi, suffix='.json')

if __name__ == '__main__':
  api = CachingRestApi("s:/tmp/trailers", expiretime=86400)
  t = u"レミニセンス"
  q = api.query(t)
  print q

  t = 9610
  q = api.query(t, type=api.EROGETRAILERS_TYPE)
  print q

  api = CachingSoftApi("s:/tmp/trailers", expiretime=86400)
  k = 3424
  k = 9869
  q = api.query(k)
Exemple #2
0
def _htmlcacher(cls):
    from restful.offline import DataCacher
    return DataCacher(cls, suffix='.html')
Exemple #3
0
# coding: utf8
# caching.py
# 8/12/2013 jichi

__all__ = 'CachingGameTableApi', 'CachingReviewTableApi'

if __name__ == '__main__':  # DEBUG
    import sys
    sys.path.append("..")

from restful.offline import DataCacher
from api import GameTableApi, ReviewTableApi

CachingGameTableApi = DataCacher(GameTableApi, suffix='.html')
CachingReviewTableApi = DataCacher(ReviewTableApi, suffix='.html')

if __name__ == '__main__':
    api = CachingGameApi("s:/tmp/scape", expiretime=86400)
    t = 15986
    q = api.query(t)
    print q

# EOF