Пример #1
0
 def testTinyEmptyBitMapToSdr(self):
   client = pycept.Cept('foo', 'bar')
   result = client._bitmapToSdr({
     'width': 1, 
     'height': 1,
     'positions': []
   })
   self.assertEqual(result, "0")
Пример #2
0
 def testSmallPartialBitMapToSdr(self):
   client = pycept.Cept('foo', 'bar')
   result = client._bitmapToSdr({
     'width': 4, 
     'height': 4,
     'positions': [2,3,6,7,10,11,14,15]
   })
   self.assertEqual(result, "0011001100110011")
Пример #3
0
 def testSmallFullBitMapToSdr(self):
   client = pycept.Cept('foo', 'bar')
   result = client._bitmapToSdr({
     'width': 4, 
     'height': 4,
     'positions': [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
   })
   self.assertEqual(result, "1111111111111111")
Пример #4
0
  def __init__(self):
    if 'CEPT_API_KEY' not in os.environ:
      print("Missing CEPT_API_KEY environment variable.")
      print("You can retrieve this by registering for the CEPT API at ")
      print("http://cept.github.io/CEPT-Website/developers_apikey.html")
      raise Exception("Missing API key.")

    self.apiKey  = os.environ['CEPT_API_KEY']

    self.client = pycept.Cept(self.apiKey, cacheDir=CACHE_DIR)
Пример #5
0
  def __init__(self):
    if 'CEPT_APP_ID' not in os.environ or 'CEPT_APP_KEY' not in os.environ:
      print("Missing CEPT_APP_ID and CEPT_APP_KEY environment variables.")
      print("You can retrieve these by registering for the CEPT API at ")
      print("https://cept.3scale.net/")
      raise

    self.appId  = os.environ['CEPT_APP_ID']
    self.appKey = os.environ['CEPT_APP_KEY']

    self.client = pycept.Cept(self.appId, self.appKey, cache_dir=CACHE_DIR)
Пример #6
0
 def __init__(self, cept_app_key, cache_dir, retina='eng_gen', verbosity=0):
     self.cept_client = pycept.Cept(cept_app_key,
                                    retina=retina,
                                    verbosity=verbosity)
     self.cache_dir = cache_dir