def test_bad_sak(self): bad_sak = SecuredAuthenticationKey("foo", "bar") with self.assertRaises(AuthenticationException): cloud_session = WolframCloudSession(credentials=bad_sak, server=self.server) cloud_session.start()
async def test_bad_sak_with(self): bad_sak = SecuredAuthenticationKey("foo", "bar") with self.assertRaises(RequestException): async with WolframCloudAsyncSession( credentials=bad_sak, server=server) as cloud_session: cloud_session.authorized()
async def test_bad_sak(self): bad_sak = SecuredAuthenticationKey('foo', 'bar') with self.assertRaises(AuthenticationException): cloud_session = WolframCloudAsyncSession(credentials=bad_sak, server=server) await cloud_session.start()
async def test_need_auth_err(self): bad_sak = SecuredAuthenticationKey("foo", "bar") with self.assertRaises(RequestException): async with WolframCloudAsyncSession( server=server) as cloud_session: await cloud_session.evaluate("1+1")
capital_distance = session.function( wlexpr('''\ QuantityMagnitude[ GeoDistance[ EntityValue[Entity["Country", #1], "CapitalCity"], EntityValue[Entity["Country", #2], "CapitalCity"] ], "Kilometers" ] & ''')) print(capital_distance('France', 'Japan')) print(capital_distance('Egypt', 'Peru')) api = ('*****@*****.**', 'api/private/xsquared') result = session.call(api, {'x': 4}) print(result.success) print(result.get()) try: # reference: # https://reference.wolfram.com/language/WolframClientForPython/docpages/basic_usages.html#wolfram-cloud-interactions sak = SecuredAuthenticationKey( "zyf7IQXKTgvd5qzSyGkqnYffxWgd+MoNbu6iASD8gcY=", "5K1k/gqeMBDcshkVpmAUJK+q0eD26SugHhESQJesxlE=") session = WolframCloudSession(credentials=sak) session.authorized() # session.start() except: session = None