From f50cd9e3188d4a46cc855b205c3e39784b7ce6c8 Mon Sep 17 00:00:00 2001 From: tikijian Date: Wed, 10 Sep 2014 23:58:45 +0400 Subject: [PATCH] working orderGet --- .gitignore | 2 ++ IntaroApy.py | 38 -------------------------------------- 2 files changed, 2 insertions(+), 38 deletions(-) delete mode 100644 IntaroApy.py diff --git a/.gitignore b/.gitignore index 1377554..9325160 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.swp +*.pyc + diff --git a/IntaroApy.py b/IntaroApy.py deleted file mode 100644 index d0730a9..0000000 --- a/IntaroApy.py +++ /dev/null @@ -1,38 +0,0 @@ -import requests - -class IntaroApy: - 'Intaro Api wrapper' - - apiVersion = '3' - - def __init__(self, crmUrl, apiKey): - self.crmUrl = crmUrl + '/api/v' + IntaroApy.apiVersion + '/' - self.apiKey = apiKey - self.parameters = { 'apiKey': apiKey } - - def requestApi(self, url, method='GET', format='json'): - - #TODO: catch http exceptions - if method == 'GET': - result = requests.get(url, params=self.parameters) - else if method == 'POST': - result = requests.post(url, data=self.parameters) - - statusCode = result.status_code - r = result.json() - - # reset params dict - self.parameters = { 'apiKey': apiKey } - - if statusCode > 400 || r.has_key('success') && r['success'] == False : - #TODO: ApiException - - if r.has_key('generatedAt') : - self.generatedAt = r['generatedAt'] - del r['generatedAt'] - - del r['success'] - - return True - -