diff --git a/Pipfile.lock b/Pipfile.lock index 11ca8cc..320f0e4 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -130,11 +130,11 @@ }, "certifi": { "hashes": [ - "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f", - "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1" + "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516", + "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56" ], "markers": "python_version >= '3.6'", - "version": "==2024.2.2" + "version": "==2024.6.2" }, "charset-normalizer": { "hashes": [ @@ -527,11 +527,11 @@ }, "requests": { "hashes": [ - "sha256:dd951ff5ecf3e3b3aa26b40703ba77495dab41da839ae72ef3c8e5d8e2433289", - "sha256:fc06670dd0ed212426dfeb94fc1b983d917c4f9847c863f313c9dfaaffb7c23c" + "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760", + "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6" ], "markers": "python_version >= '3.8'", - "version": "==2.32.2" + "version": "==2.32.3" }, "six": { "hashes": [ @@ -810,11 +810,11 @@ }, "certifi": { "hashes": [ - "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f", - "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1" + "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516", + "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56" ], "markers": "python_version >= '3.6'", - "version": "==2024.2.2" + "version": "==2024.6.2" }, "charset-normalizer": { "hashes": [ @@ -922,61 +922,61 @@ }, "coverage": { "hashes": [ - "sha256:0646599e9b139988b63704d704af8e8df7fa4cbc4a1f33df69d97f36cb0a38de", - "sha256:0cdcbc320b14c3e5877ee79e649677cb7d89ef588852e9583e6b24c2e5072661", - "sha256:0d0a0f5e06881ecedfe6f3dd2f56dcb057b6dbeb3327fd32d4b12854df36bf26", - "sha256:1434e088b41594baa71188a17533083eabf5609e8e72f16ce8c186001e6b8c41", - "sha256:16db7f26000a07efcf6aea00316f6ac57e7d9a96501e990a36f40c965ec7a95d", - "sha256:1cc0fe9b0b3a8364093c53b0b4c0c2dd4bb23acbec4c9240b5f284095ccf7981", - "sha256:1fc81d5878cd6274ce971e0a3a18a8803c3fe25457165314271cf78e3aae3aa2", - "sha256:2ec92012fefebee89a6b9c79bc39051a6cb3891d562b9270ab10ecfdadbc0c34", - "sha256:39afcd3d4339329c5f58de48a52f6e4e50f6578dd6099961cf22228feb25f38f", - "sha256:4a7b0ceee8147444347da6a66be737c9d78f3353b0681715b668b72e79203e4a", - "sha256:4a9ca3f2fae0088c3c71d743d85404cec8df9be818a005ea065495bedc33da35", - "sha256:4bf0655ab60d754491004a5efd7f9cccefcc1081a74c9ef2da4735d6ee4a6223", - "sha256:4cc37def103a2725bc672f84bd939a6fe4522310503207aae4d56351644682f1", - "sha256:4fc84a37bfd98db31beae3c2748811a3fa72bf2007ff7902f68746d9757f3746", - "sha256:5037f8fcc2a95b1f0e80585bd9d1ec31068a9bcb157d9750a172836e98bc7a90", - "sha256:54de9ef3a9da981f7af93eafde4ede199e0846cd819eb27c88e2b712aae9708c", - "sha256:556cf1a7cbc8028cb60e1ff0be806be2eded2daf8129b8811c63e2b9a6c43bca", - "sha256:57e0204b5b745594e5bc14b9b50006da722827f0b8c776949f1135677e88d0b8", - "sha256:5a5740d1fb60ddf268a3811bcd353de34eb56dc24e8f52a7f05ee513b2d4f596", - "sha256:5c3721c2c9e4c4953a41a26c14f4cef64330392a6d2d675c8b1db3b645e31f0e", - "sha256:5fa567e99765fe98f4e7d7394ce623e794d7cabb170f2ca2ac5a4174437e90dd", - "sha256:5fd215c0c7d7aab005221608a3c2b46f58c0285a819565887ee0b718c052aa4e", - "sha256:6175d1a0559986c6ee3f7fccfc4a90ecd12ba0a383dcc2da30c2b9918d67d8a3", - "sha256:61c4bf1ba021817de12b813338c9be9f0ad5b1e781b9b340a6d29fc13e7c1b5e", - "sha256:6537e7c10cc47c595828b8a8be04c72144725c383c4702703ff4e42e44577312", - "sha256:68f962d9b72ce69ea8621f57551b2fa9c70509af757ee3b8105d4f51b92b41a7", - "sha256:7352b9161b33fd0b643ccd1f21f3a3908daaddf414f1c6cb9d3a2fd618bf2572", - "sha256:796a79f63eca8814ca3317a1ea443645c9ff0d18b188de470ed7ccd45ae79428", - "sha256:79afb6197e2f7f60c4824dd4b2d4c2ec5801ceb6ba9ce5d2c3080e5660d51a4f", - "sha256:7a588d39e0925f6a2bff87154752481273cdb1736270642aeb3635cb9b4cad07", - "sha256:8748731ad392d736cc9ccac03c9845b13bb07d020a33423fa5b3a36521ac6e4e", - "sha256:8fe7502616b67b234482c3ce276ff26f39ffe88adca2acf0261df4b8454668b4", - "sha256:9314d5678dcc665330df5b69c1e726a0e49b27df0461c08ca12674bcc19ef136", - "sha256:9735317685ba6ec7e3754798c8871c2f49aa5e687cc794a0b1d284b2389d1bd5", - "sha256:9981706d300c18d8b220995ad22627647be11a4276721c10911e0e9fa44c83e8", - "sha256:9e78295f4144f9dacfed4f92935fbe1780021247c2fabf73a819b17f0ccfff8d", - "sha256:b016ea6b959d3b9556cb401c55a37547135a587db0115635a443b2ce8f1c7228", - "sha256:b6cf3764c030e5338e7f61f95bd21147963cf6aa16e09d2f74f1fa52013c1206", - "sha256:beccf7b8a10b09c4ae543582c1319c6df47d78fd732f854ac68d518ee1fb97fa", - "sha256:c0884920835a033b78d1c73b6d3bbcda8161a900f38a488829a83982925f6c2e", - "sha256:c3e757949f268364b96ca894b4c342b41dc6f8f8b66c37878aacef5930db61be", - "sha256:ca498687ca46a62ae590253fba634a1fe9836bc56f626852fb2720f334c9e4e5", - "sha256:d1d0d98d95dd18fe29dc66808e1accf59f037d5716f86a501fc0256455219668", - "sha256:d21918e9ef11edf36764b93101e2ae8cc82aa5efdc7c5a4e9c6c35a48496d601", - "sha256:d7fed867ee50edf1a0b4a11e8e5d0895150e572af1cd6d315d557758bfa9c057", - "sha256:db66fc317a046556a96b453a58eced5024af4582a8dbdc0c23ca4dbc0d5b3146", - "sha256:dde0070c40ea8bb3641e811c1cfbf18e265d024deff6de52c5950677a8fb1e0f", - "sha256:df4e745a81c110e7446b1cc8131bf986157770fa405fe90e15e850aaf7619bc8", - "sha256:e2213def81a50519d7cc56ed643c9e93e0247f5bbe0d1247d15fa520814a7cd7", - "sha256:ef48e2707fb320c8f139424a596f5b69955a85b178f15af261bab871873bb987", - "sha256:f152cbf5b88aaeb836127d920dd0f5e7edff5a66f10c079157306c4343d86c19", - "sha256:fc0b4d8bfeabd25ea75e94632f5b6e047eef8adaed0c2161ada1e922e7f7cece" + "sha256:015eddc5ccd5364dcb902eaecf9515636806fa1e0d5bef5769d06d0f31b54523", + "sha256:04aefca5190d1dc7a53a4c1a5a7f8568811306d7a8ee231c42fb69215571944f", + "sha256:05ac5f60faa0c704c0f7e6a5cbfd6f02101ed05e0aee4d2822637a9e672c998d", + "sha256:0bbddc54bbacfc09b3edaec644d4ac90c08ee8ed4844b0f86227dcda2d428fcb", + "sha256:1d2a830ade66d3563bb61d1e3c77c8def97b30ed91e166c67d0632c018f380f0", + "sha256:239a4e75e09c2b12ea478d28815acf83334d32e722e7433471fbf641c606344c", + "sha256:244f509f126dc71369393ce5fea17c0592c40ee44e607b6d855e9c4ac57aac98", + "sha256:25a5caf742c6195e08002d3b6c2dd6947e50efc5fc2c2205f61ecb47592d2d83", + "sha256:296a7d9bbc598e8744c00f7a6cecf1da9b30ae9ad51c566291ff1314e6cbbed8", + "sha256:2e079c9ec772fedbade9d7ebc36202a1d9ef7291bc9b3a024ca395c4d52853d7", + "sha256:33ca90a0eb29225f195e30684ba4a6db05dbef03c2ccd50b9077714c48153cac", + "sha256:33fc65740267222fc02975c061eb7167185fef4cc8f2770267ee8bf7d6a42f84", + "sha256:341dd8f61c26337c37988345ca5c8ccabeff33093a26953a1ac72e7d0103c4fb", + "sha256:34d6d21d8795a97b14d503dcaf74226ae51eb1f2bd41015d3ef332a24d0a17b3", + "sha256:3538d8fb1ee9bdd2e2692b3b18c22bb1c19ffbefd06880f5ac496e42d7bb3884", + "sha256:38a3b98dae8a7c9057bd91fbf3415c05e700a5114c5f1b5b0ea5f8f429ba6614", + "sha256:3d5a67f0da401e105753d474369ab034c7bae51a4c31c77d94030d59e41df5bd", + "sha256:50084d3516aa263791198913a17354bd1dc627d3c1639209640b9cac3fef5807", + "sha256:55f689f846661e3f26efa535071775d0483388a1ccfab899df72924805e9e7cd", + "sha256:5bc5a8c87714b0c67cfeb4c7caa82b2d71e8864d1a46aa990b5588fa953673b8", + "sha256:62bda40da1e68898186f274f832ef3e759ce929da9a9fd9fcf265956de269dbc", + "sha256:705f3d7c2b098c40f5b81790a5fedb274113373d4d1a69e65f8b68b0cc26f6db", + "sha256:75e3f4e86804023e991096b29e147e635f5e2568f77883a1e6eed74512659ab0", + "sha256:7b2a19e13dfb5c8e145c7a6ea959485ee8e2204699903c88c7d25283584bfc08", + "sha256:7cec2af81f9e7569280822be68bd57e51b86d42e59ea30d10ebdbb22d2cb7232", + "sha256:8383a6c8cefba1b7cecc0149415046b6fc38836295bc4c84e820872eb5478b3d", + "sha256:8c836309931839cca658a78a888dab9676b5c988d0dd34ca247f5f3e679f4e7a", + "sha256:8e317953bb4c074c06c798a11dbdd2cf9979dbcaa8ccc0fa4701d80042d4ebf1", + "sha256:923b7b1c717bd0f0f92d862d1ff51d9b2b55dbbd133e05680204465f454bb286", + "sha256:990fb20b32990b2ce2c5f974c3e738c9358b2735bc05075d50a6f36721b8f303", + "sha256:9aad68c3f2566dfae84bf46295a79e79d904e1c21ccfc66de88cd446f8686341", + "sha256:a5812840d1d00eafae6585aba38021f90a705a25b8216ec7f66aebe5b619fb84", + "sha256:a6519d917abb15e12380406d721e37613e2a67d166f9fb7e5a8ce0375744cd45", + "sha256:ab0b028165eea880af12f66086694768f2c3139b2c31ad5e032c8edbafca6ffc", + "sha256:aea7da970f1feccf48be7335f8b2ca64baf9b589d79e05b9397a06696ce1a1ec", + "sha256:b1196e13c45e327d6cd0b6e471530a1882f1017eb83c6229fc613cd1a11b53cd", + "sha256:b368e1aee1b9b75757942d44d7598dcd22a9dbb126affcbba82d15917f0cc155", + "sha256:bde997cac85fcac227b27d4fb2c7608a2c5f6558469b0eb704c5726ae49e1c52", + "sha256:c4c2872b3c91f9baa836147ca33650dc5c172e9273c808c3c3199c75490e709d", + "sha256:c59d2ad092dc0551d9f79d9d44d005c945ba95832a6798f98f9216ede3d5f485", + "sha256:d1da0a2e3b37b745a2b2a678a4c796462cf753aebf94edcc87dcc6b8641eae31", + "sha256:d8b7339180d00de83e930358223c617cc343dd08e1aa5ec7b06c3a121aec4e1d", + "sha256:dd4b3355b01273a56b20c219e74e7549e14370b31a4ffe42706a8cda91f19f6d", + "sha256:e08c470c2eb01977d221fd87495b44867a56d4d594f43739a8028f8646a51e0d", + "sha256:f5102a92855d518b0996eb197772f5ac2a527c0ec617124ad5242a3af5e25f85", + "sha256:f542287b1489c7a860d43a7d8883e27ca62ab84ca53c965d11dac1d3a1fab7ce", + "sha256:f78300789a708ac1f17e134593f577407d52d0417305435b134805c4fb135adb", + "sha256:f81bc26d609bf0fbc622c7122ba6307993c83c795d2d6f6f6fd8c000a770d974", + "sha256:f836c174c3a7f639bded48ec913f348c4761cbf49de4a20a956d3431a7c9cb24", + "sha256:fa21a04112c59ad54f69d80e376f7f9d0f5f9123ab87ecd18fbb9ec3a2beed56", + "sha256:fcf7d1d6f5da887ca04302db8e0e0cf56ce9a5e05f202720e49b3e8157ddb9a9", + "sha256:fd27d8b49e574e50caa65196d908f80e4dff64d7e592d0c59788b45aad7e8b35" ], "index": "pypi", - "version": "==7.5.1" + "version": "==7.5.3" }, "decorator": { "hashes": [ @@ -1103,10 +1103,10 @@ }, "ipython": { "hashes": [ - "sha256:010db3f8a728a578bb641fdd06c063b9fb8e96a9464c63aec6310fbcb5e80501", - "sha256:d7bf2f6c4314984e3e02393213bab8703cf163ede39672ce5918c51fe253a2a3" + "sha256:53eee7ad44df903a06655871cbab66d156a051fd86f3ec6750470ac9604ac1ab", + "sha256:c6ed726a140b6e725b911528f80439c534fac915246af3efc39440a6b0f9d716" ], - "version": "==8.24.0" + "version": "==8.25.0" }, "jedi": { "hashes": [ @@ -1440,11 +1440,11 @@ }, "prompt-toolkit": { "hashes": [ - "sha256:3527b7af26106cbc65a040bcc84839a3566ec1b051bb0bfe953631e704b0ff7d", - "sha256:a11a29cb3bf0a28a387fe5122cdb649816a957cd9261dcedf8c9f1fef33eacf6" + "sha256:45abe60a8300f3c618b23c16c4bb98c6fc80af8ce8b17c7ae92db48db3ee63c1", + "sha256:869c50d682152336e23c4db7f74667639b5047494202ffe7670817053fd57795" ], "markers": "python_full_version >= '3.7.0'", - "version": "==3.0.43" + "version": "==3.0.46" }, "ptyprocess": { "hashes": [ @@ -1477,11 +1477,11 @@ }, "pytest": { "hashes": [ - "sha256:5046e5b46d8e4cac199c373041f26be56fdb81eb4e67dc11d4e10811fc3408fd", - "sha256:faccc5d332b8c3719f40283d0d44aa5cf101cec36f88cde9ed8f2bc0538612b1" + "sha256:c434598117762e2bd304e526244f67bf66bbd7b5d6cf22138be51ff661980343", + "sha256:de4bb8104e201939ccdc688b27a89a7be2079b22e2bd2b07f806b6ba71117977" ], "index": "pypi", - "version": "==8.2.1" + "version": "==8.2.2" }, "pytest-asyncio": { "hashes": [ @@ -1686,11 +1686,11 @@ }, "requests": { "hashes": [ - "sha256:dd951ff5ecf3e3b3aa26b40703ba77495dab41da839ae72ef3c8e5d8e2433289", - "sha256:fc06670dd0ed212426dfeb94fc1b983d917c4f9847c863f313c9dfaaffb7c23c" + "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760", + "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6" ], "markers": "python_version >= '3.8'", - "version": "==2.32.2" + "version": "==2.32.3" }, "requests-mock": { "hashes": [ @@ -1710,26 +1710,26 @@ }, "ruff": { "hashes": [ - "sha256:1aecced1269481ef2894cc495647392a34b0bf3e28ff53ed95a385b13aa45768", - "sha256:29d44ef5bb6a08e235c8249294fa8d431adc1426bfda99ed493119e6f9ea1bf6", - "sha256:39df0537b47d3b597293edbb95baf54ff5b49589eb7ff41926d8243caa995ea6", - "sha256:424e5b72597482543b684c11def82669cc6b395aa8cc69acc1858b5ef3e5daae", - "sha256:4c8e2f1e8fc12d07ab521a9005d68a969e167b589cbcaee354cb61e9d9de9c15", - "sha256:60ed88b636a463214905c002fa3eaab19795679ed55529f91e488db3fe8976ab", - "sha256:8e7e6ebc10ef16dcdc77fd5557ee60647512b400e4a60bdc4849468f076f6eef", - "sha256:958b4ea5589706a81065e2a776237de2ecc3e763342e5cc8e02a4a4d8a5e6f95", - "sha256:9da73eb616b3241a307b837f32756dc20a0b07e2bcb694fec73699c93d04a69e", - "sha256:b1867ee9bf3acc21778dcb293db504692eda5f7a11a6e6cc40890182a9f9e595", - "sha256:b5eb0a4bfd6400b7d07c09a7725e1a98c3b838be557fee229ac0f84d9aa49c36", - "sha256:b90fc5e170fc71c712cc4d9ab0e24ea505c6a9e4ebf346787a67e691dfb72e85", - "sha256:b9ddb2c494fb79fc208cd15ffe08f32b7682519e067413dbaf5f4b01a6087bcd", - "sha256:c4efe62b5bbb24178c950732ddd40712b878a9b96b1d02b0ff0b08a090cbd891", - "sha256:c51c928a14f9f0a871082603e25a1588059b7e08a920f2f9fa7157b5bf08cfe9", - "sha256:cb53473849f011bca6e754f2cdf47cafc9c4f4ff4570003a0dad0b9b6890e876", - "sha256:f87ea42d5cdebdc6a69761a9d0bc83ae9b3b30d0ad78952005ba6568d6c022af" + "sha256:07fc80bbb61e42b3b23b10fda6a2a0f5a067f810180a3760c5ef1b456c21b9db", + "sha256:10f2204b9a613988e3484194c2c9e96a22079206b22b787605c255f130db5ed7", + "sha256:10f973d521d910e5f9c72ab27e409e839089f955be8a4c8826601a6323a89753", + "sha256:13a1768b0691619822ae6d446132dbdfd568b700ecd3652b20d4e8bc1e498f78", + "sha256:2331d2b051dc77a289a653fcc6a42cce357087c5975738157cd966590b18b5e1", + "sha256:50e9651578b629baec3d1513b2534de0ac7ed7753e1382272b8d609997e27e83", + "sha256:59c3d110970001dfa494bcd95478e62286c751126dfb15c3c46e7915fc49694f", + "sha256:769e5a51df61e07e887b81e6f039e7ed3573316ab7dd9f635c5afaa310e4030e", + "sha256:8874a9df7766cb956b218a0a239e0a5d23d9e843e4da1e113ae1d27ee420877a", + "sha256:9e3ab684ad403a9ed1226894c32c3ab9c2e0718440f6f50c7c5829932bc9e054", + "sha256:a7c0083febdec17571455903b184a10026603a1de078428ba155e7ce9358c5f6", + "sha256:ad1b20e66a44057c326168437d680a2166c177c939346b19c0d6b08a62a37589", + "sha256:b9de9a6e49f7d529decd09381c0860c3f82fa0b0ea00ea78409b785d2308a567", + "sha256:cbf5d818553add7511c38b05532d94a407f499d1a76ebb0cad0374e32bc67202", + "sha256:e089371c67892a73b6bb1525608e89a2aca1b77b5440acf7a71dda5dac958f9e", + "sha256:fa4dafe3fe66d90e2e2b63fa1591dd6e3f090ca2128daa0be33db894e6c18648", + "sha256:fa9773c6c00f4958f73b317bc0fd125295110c3776089f6ef318f4b775f0abe4" ], "index": "pypi", - "version": "==0.4.4" + "version": "==0.4.7" }, "six": { "hashes": [ @@ -1787,27 +1787,27 @@ }, "types-requests": { "hashes": [ - "sha256:ab728ba43ffb073db31f21202ecb97db8753ded4a9dc49cb480d8a5350c5c421", - "sha256:c5c4a0ae95aad51f1bf6dae9eed04a78f7f2575d4b171da37b622e08b93eb5d3" + "sha256:3f98d7bbd0dd94ebd10ff43a7fbe20c3b8528acace6d8efafef0b6a184793f06", + "sha256:ed3946063ea9fbc6b5fc0c44fa279188bae42d582cb63760be6cb4b9d06c3de8" ], "index": "pypi", - "version": "==2.32.0.20240521" + "version": "==2.32.0.20240602" }, "types-setuptools": { "hashes": [ - "sha256:c5a97601b2d040d3b9fcd0633730f0a8c86ebef208552525c97301427f261549", - "sha256:e27231cbc80648cfaee4921d2f1150107fdf8d33666958abf2aba0191a82688b" + "sha256:8f5379b9948682d72a9ab531fbe52932e84c4f38deda570255f9bae3edd766bc", + "sha256:e31fee7b9d15ef53980526579ac6089b3ae51a005a281acf97178e90ac71aff6" ], "index": "pypi", - "version": "==69.5.0.20240522" + "version": "==70.0.0.20240524" }, "typing-extensions": { "hashes": [ - "sha256:be199d06d8f09ca2c9425e3aa04a9afba33e892fe079dea959e72df7f8442343", - "sha256:f933a7b288a919ca97adbff656e52ff81f7ff25d98a2aabb9355ca4090f772fe" + "sha256:6024b58b69089e5a89c347397254e35f1bf02a907728ec7fee9bf0fe837d203a", + "sha256:915f5e35ff76f56588223f15fdd5938f9a1cf9195c0de25130c627e4d597f6d1" ], "markers": "python_version < '3.11'", - "version": "==4.12.0rc1" + "version": "==4.12.1" }, "tzdata": { "hashes": [ diff --git a/mygeotab/altitude/__init__.py b/mygeotab/altitude/__init__.py index b72742b..c700c19 100644 --- a/mygeotab/altitude/__init__.py +++ b/mygeotab/altitude/__init__.py @@ -1,6 +1,12 @@ from .wrapper import AltitudeAPI -from .daas_definition import DaasResult, DaasGetJobStatusResult, DaasGetQueryResult, DaasError, NOT_FULL_API_CALL_EXCEPTION +from .daas_definition import ( + DaasResult, + DaasGetJobStatusResult, + DaasGetQueryResult, + DaasError, + NOT_FULL_API_CALL_EXCEPTION, +) __all__ = [ "AltitudeAPI", diff --git a/mygeotab/altitude/daas_definition.py b/mygeotab/altitude/daas_definition.py index 79ab9dd..994fa40 100644 --- a/mygeotab/altitude/daas_definition.py +++ b/mygeotab/altitude/daas_definition.py @@ -1,12 +1,14 @@ - class DaasError: def __init__(self, error: dict): self.error = error - self.code = self.error['code'] - self.domain = self.error['domain'] - self.message = self.error['message'] + self.code = self.error["code"] + self.domain = self.error["domain"] + self.message = self.error["message"] + NOT_FULL_API_CALL_EXCEPTION = Exception("api return did not have all expected attributes, please retry again.") + + class DaasResult: """DaasResult class, the base class for all results returned from calling our application from the gateway @@ -19,10 +21,9 @@ class DaasResult: api_result_errors (list): possible errors list that happened on the altitude application. api_result_error_message (str): possible single error message that happened on the altitude application. api_result_error (DaasError): possible single error object that happened on the altitude application. - errors (list): list of all the errors (gateway and altitude application) combined together. + errors (list): list of all the errors (gateway and altitude application) combined together. """ - def __init__(self, call_result: dict): if not call_result: @@ -32,10 +33,7 @@ def __init__(self, call_result: dict): self.call_result = call_result self.daas_errors = [DaasError(error) for error in self.call_result.get("errors", [])] - self.errors = [ - Exception(error.message) for error in self.daas_errors - ] - + self.errors = [Exception(error.message) for error in self.daas_errors] if "apiResult" not in call_result: self.errors += [Exception("apiResult not present"), NOT_FULL_API_CALL_EXCEPTION] @@ -45,33 +43,24 @@ def __init__(self, call_result: dict): self.jobs = self.api_result["results"] self.job = self.jobs[0] - self.api_result_errors = [DaasError(error) for error in self.api_result.get("errors", [])] self.api_result_error_message = self.api_result.get("errorMessage", None) self.api_result_error = None + self.errors += [Exception(error.message) for error in self.api_result_errors] - - - self.errors += [ - Exception(error.message) for error in self.api_result_errors - ] - - - if "error" in self.api_result and self.api_result["error"]: + if "error" in self.api_result and self.api_result["error"]: self.api_result_error = DaasError(self.api_result["error"]) - self.errors += [ - Exception(self.api_result_error.message) - ] + self.errors += [Exception(self.api_result_error.message)] - if self.api_result_error_message and isinstance(self.api_result_error_message, str) and len(self.api_result_error_message): - self.errors += [ - Exception(self.api_result_error_message) - ] - elif self.api_result_error_message and isinstance(self.api_result_error_message, dict): - self.errors += [ - Exception(self.api_result_error_message["message"]) - ] + if ( + self.api_result_error_message + and isinstance(self.api_result_error_message, str) + and len(self.api_result_error_message) + ): + self.errors += [Exception(self.api_result_error_message)] + elif self.api_result_error_message and isinstance(self.api_result_error_message, dict): + self.errors += [Exception(self.api_result_error_message["message"])] class DaasGetJobStatusResult(DaasResult): @@ -82,23 +71,22 @@ class DaasGetJobStatusResult(DaasResult): status (dict): the status of the job state (str): the state of the job (from the status object) """ - - + def __init__(self, call_result: dict): super().__init__(call_result) - self.id = self.job['id'] - self.status = self.job.get("status", {'state': 'FAILED'}) + self.id = self.job["id"] + self.status = self.job.get("status", {"state": "FAILED"}) self.state = self.status.get("state", "FAILED") + def has_finished(self): - if self.state == 'DONE': + if self.state == "DONE": return True - elif self.state != 'FAILED': + elif self.state != "FAILED": return False - elif self.state == 'FAILED' and self.errors and len(self.errors) > 0: + elif self.state == "FAILED" and self.errors and len(self.errors) > 0: return False else: raise Exception("got to failed state with no error, please reach out.") - class DaasGetQueryResult(DaasResult): @@ -109,12 +97,9 @@ class DaasGetQueryResult(DaasResult): rows (list): the rows including the data pageToken (str): the token of the page """ - - + def __init__(self, call_result: dict): super().__init__(call_result) - self.total_rows = self.job.get('totalRows', None) - self.rows = self.job.get('rows', None) - self.page_token = self.job.get('pageToken', None) - - + self.total_rows = self.job.get("totalRows", None) + self.rows = self.job.get("rows", None) + self.page_token = self.job.get("pageToken", None) diff --git a/mygeotab/altitude/wrapper.py b/mygeotab/altitude/wrapper.py index 28673fd..fc6a6f0 100644 --- a/mygeotab/altitude/wrapper.py +++ b/mygeotab/altitude/wrapper.py @@ -49,13 +49,14 @@ def __init__( proxies=proxies, cert=cert, ) - _ = logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s', datefmt='%Y-%m-%d %H:%M:%S') - - + _ = logging.basicConfig( + stream=sys.stdout, + level=logging.INFO, + format="%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s", + datefmt="%Y-%m-%d %H:%M:%S", + ) - def _call_api( - self, service_name: str, function_name: str, function_parameters: dict - ) -> dict: + def _call_api(self, service_name: str, function_name: str, function_parameters: dict) -> dict: results = self.call( method="GetBigDataResults", serviceName=service_name, @@ -64,12 +65,10 @@ def _call_api( ) return results - - - def call_api(self, function_name: str, params: dict) -> dict : - ''' + def call_api(self, function_name: str, params: dict) -> dict: + """ Supports getJobStatus calls, and getQueryResults calls. Retries in case of errors like connection rest. - ''' + """ assert function_name in ["getJobStatus", "getQueryResults", "createQueryJob"] max_tries = 5 for try_index in range(max_tries): @@ -87,7 +86,7 @@ def call_api(self, function_name: str, params: dict) -> dict : raise e else: print(f"encountered error trying to parse to api response {str(call_result)}, retrying....") - time.sleep((try_index + 1)*10) + time.sleep((try_index + 1) * 10) else: raise e @@ -139,8 +138,6 @@ def wait_for_job_to_complete(self, params: dict) -> dict: raise e return daas_status.job - - def fetch_data(self, params: dict) -> dict: """ fetch data for the given params. jobId needs to be included in params. @@ -194,7 +191,7 @@ def get_data(self, params: dict) -> list: logging.error(f"error: error while combining data:: {e}") raise e return data - + def do(self, params: dict) -> list: """ given the parameters, will call the request, wait on it to finish and return the combined data. @@ -210,13 +207,3 @@ def do(self, params: dict) -> list: data = self.get_data(params) logging.info(f"data gathered") return data - - - - - - - - - - diff --git a/mygeotab/api.py b/mygeotab/api.py index de1c5c0..93db385 100644 --- a/mygeotab/api.py +++ b/mygeotab/api.py @@ -351,10 +351,12 @@ class GeotabHTTPAdapter(HTTPAdapter): def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs): ssl_context = create_urllib3_context(ssl_version=ssl.PROTOCOL_TLS) + ssl_context.load_default_certs() ssl_context.options |= ssl.OP_NO_SSLv2 ssl_context.options |= ssl.OP_NO_SSLv3 ssl_context.options |= ssl.OP_NO_TLSv1 ssl_context.options |= ssl.OP_NO_TLSv1_1 + ssl_context.options |= ssl.OP_ENABLE_MIDDLEBOX_COMPAT self.poolmanager = urllib3.poolmanager.PoolManager( num_pools=connections, maxsize=maxsize, block=block, ssl_context=ssl_context, **pool_kwargs ) diff --git a/mygeotab/api_async.py b/mygeotab/api_async.py index db4da8d..9e87290 100644 --- a/mygeotab/api_async.py +++ b/mygeotab/api_async.py @@ -203,10 +203,12 @@ async def _query(server, method, parameters, timeout=DEFAULT_TIMEOUT, verify_ssl ssl_context = False if verify_ssl or cert: ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS) + ssl_context.load_default_certs() ssl_context.options |= ssl.OP_NO_SSLv2 ssl_context.options |= ssl.OP_NO_SSLv3 ssl_context.options |= ssl.OP_NO_TLSv1 ssl_context.options |= ssl.OP_NO_TLSv1_1 + ssl_context.options |= ssl.OP_ENABLE_MIDDLEBOX_COMPAT if cert: if isinstance(cert, str): ssl_context.load_cert_chain(cert) diff --git a/setup.py b/setup.py index f90d23d..abb1285 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,15 @@ packages=packages, package_data={"": ["LICENSE"]}, license="Apache 2.0", - install_requires=["requests", "urllib3", "click", "pytz", "arrow", "aiohttp>=3.8.1,<4", "python-rapidjson"], + install_requires=[ + "requests", + "urllib3", + "click", + "pytz", + "arrow", + "aiohttp>=3.8.1,<4", + "python-rapidjson", + ], setup_requires=["wheel"], entry_points=""" [console_scripts]