Skip to content

Commit 375b7a1

Browse files
author
Iván Ramos Muñoz
authored
Merge pull request #13 from ElevenPaths/i91503
Create a new API request /uploadURL
2 parents 4ae582b + 7a1d549 commit 375b7a1

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from setuptools import setup, find_packages
22

33
setup(name='tacytsdk',
4-
version='2.5',
4+
version='2.6',
55
description='Tacyt SDK',
66
url='https://github.com/ElevenPaths/tacyt-sdk-python',
77
author='ElevenPaths',

tacyt/ExternalApiUploadURLRequest.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
'''
4+
This library offers an API to use Tacyt in a python environment.
5+
Copyright (C) 2019 Eleven Paths
6+
'''
7+
8+
class ExternalApiUploadURLRequest:
9+
10+
def __init__(self, urls, tagNames=None):
11+
self.urls = urls
12+
self.tagNames = tagNames
13+
14+
def get_json_encode_for_upload_url(self):
15+
json_data = dict()
16+
if self.urls is not None:
17+
json_data["urls"] = self.urls
18+
if self.tagNames is not None:
19+
json_data["tagNames"] = self.tagNames
20+
21+
return json_data

tacyt/TacytApp.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
from ExternalApiCompareRequest import ExternalApiCompareRequest
88
from ExternalApiSearchRequest import ExternalApiSearchRequest
99
from ExternalApiEngineVersionRequest import ExternalApiEngineVersionRequest
10+
from tacyt.ExternalApiUploadURLRequest import ExternalApiUploadURLRequest
1011
from Version import Version
1112
from authorization.Auth import Auth
1213

1314
import hashlib
1415
from os import path
1516

16-
17-
1817
try:
1918
import simplejson as json
2019
except ImportError:
@@ -33,6 +32,7 @@ class TacytApp(Auth):
3332
API_COMPARER_URL = "/api/"+Version.API_VERSION+"/compare"
3433
API_UPLOAD_URL = "/api/" +Version.API_VERSION+ "/upload"
3534
API_ENGINE_VERSION_URL = "/api/" +Version.API_VERSION+ "/engineVersion"
35+
API_UPLOADURL_URL = "/api/" +Version.API_VERSION+ "/uploadURL"
3636

3737
def __init__(self, app_id, secret_key):
3838
'''
@@ -240,4 +240,14 @@ def getEngineVersion(self, date=None, engineId=None, lang=None):
240240
if engineId or date or lang:
241241
externalEngineVersion = ExternalApiEngineVersionRequest(date, engineId, lang)
242242
params = "?" + externalEngineVersion.get_encoded_params()
243-
return self.http_get(self.API_ENGINE_VERSION_URL + params, None)
243+
return self.http_get(self.API_ENGINE_VERSION_URL + params, None)
244+
245+
def uploadURL(self, urls, tagNames=None):
246+
"""
247+
Download apps from a market URLs
248+
:param urls: List of urls to upload
249+
:param tagNames List of tags to identify the application
250+
:return: Response
251+
"""
252+
externalApiUploadURL = ExternalApiUploadURLRequest(urls, tagNames)
253+
return self.http_post(self.API_UPLOADURL_URL, headers=None, body=externalApiUploadURL.get_json_encode_for_upload_url())

tacyt/Version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ class Version:
55
def __init__(self):
66
pass
77

8-
API_VERSION = "2.5"
8+
API_VERSION = "2.6"
99
API_HOST = "tacyt.elevenpaths.com"

0 commit comments

Comments
 (0)