From 0a2ebf1c4f8493c1876f13e7261759ebdea515be Mon Sep 17 00:00:00 2001 From: victorgodinho-meli Date: Tue, 14 Jan 2020 12:49:07 -0300 Subject: [PATCH 1/4] Update mercadopago.py --- mercadopago/mercadopago.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mercadopago/mercadopago.py b/mercadopago/mercadopago.py index 021ddc2..eaa83df 100644 --- a/mercadopago/mercadopago.py +++ b/mercadopago/mercadopago.py @@ -12,6 +12,7 @@ from requests.packages.urllib3.poolmanager import PoolManager import ssl +import platform class MPSSLAdapter(HTTPAdapter): def init_poolmanager(self, connections, maxsize, block=False): @@ -31,7 +32,7 @@ class MPInvalidCredentials(MPException): class MP(object): - version = "0.3.4" + version = "1.1.0" __access_data = None __ll_access_token = None __sandbox = False @@ -319,6 +320,8 @@ class __RestClient(object): def __init__(self, outer): self.__outer = outer self.USER_AGENT = "MercadoPago Python SDK v"+self.__outer.version + self.PRODUCT_ID = "bc32bpftrpp001u8nhlg" + self.TRACKING_ID = "platform:"+platform.python_version()+",type:SDK"+self.__outer.version+",so;" def get_mercadopago_transport_adapter(self): """Creates and returns the transport adaptor for MP""" @@ -335,7 +338,7 @@ def get_session(self): def get(self, uri, params=None): s = self.get_session() - api_result = s.get(self.__API_BASE_URL+uri, params=params, headers={'User-Agent':self.USER_AGENT, 'Accept':self.MIME_JSON}) + api_result = s.get(self.__API_BASE_URL+uri, params=params, headers={'x-product-id': self.PRODUCT_ID, 'x-tracking-id': self.TRACKING_ID, 'User-Agent':self.USER_AGENT, 'Accept':self.MIME_JSON}) response = { "status": api_result.status_code, @@ -349,7 +352,7 @@ def post(self, uri, data=None, params=None, content_type=MIME_JSON): data = JSONEncoder().encode(data) s = self.get_session() - api_result = s.post(self.__API_BASE_URL+uri, params=params, data=data, headers={'User-Agent':self.USER_AGENT, 'Content-type':content_type, 'Accept':self.MIME_JSON}) + api_result = s.post(self.__API_BASE_URL+uri, params=params, data=data, headers={'x-product-id': self.PRODUCT_ID, 'x-tracking-id': self.TRACKING_ID, 'User-Agent':self.USER_AGENT, 'Content-type':content_type, 'Accept':self.MIME_JSON}) response = { "status": api_result.status_code, @@ -363,7 +366,7 @@ def put(self, uri, data=None, params=None, content_type=MIME_JSON): data = JSONEncoder().encode(data) s = self.get_session() - api_result = s.put(self.__API_BASE_URL+uri, params=params, data=data, headers={'User-Agent':self.USER_AGENT, 'Content-type':content_type, 'Accept':self.MIME_JSON}) + api_result = s.put(self.__API_BASE_URL+uri, params=params, data=data, headers={'x-product-id': self.PRODUCT_ID, 'x-tracking-id': self.TRACKING_ID, 'User-Agent':self.USER_AGENT, 'Content-type':content_type, 'Accept':self.MIME_JSON}) response = { "status": api_result.status_code, @@ -374,7 +377,7 @@ def put(self, uri, data=None, params=None, content_type=MIME_JSON): def delete(self, uri, params=None): s = self.get_session() - api_result = s.delete(self.__API_BASE_URL+uri, params=params, headers={'User-Agent':self.USER_AGENT, 'Accept':self.MIME_JSON}) + api_result = s.delete(self.__API_BASE_URL+uri, params=params, headers={'x-product-id': self.PRODUCT_ID, 'x-tracking-id': self.TRACKING_ID, 'User-Agent':self.USER_AGENT, 'Accept':self.MIME_JSON}) response = { "status": api_result.status_code, From cd074ca369dfa23f083a0f212946de8f140f1239 Mon Sep 17 00:00:00 2001 From: Danilo Elias Date: Mon, 20 Jan 2020 13:37:15 -0300 Subject: [PATCH 2/4] Adding major version info in tracking id --- mercadopago/mercadopago.py | 5 +++-- setup.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mercadopago/mercadopago.py b/mercadopago/mercadopago.py index eaa83df..510106a 100644 --- a/mercadopago/mercadopago.py +++ b/mercadopago/mercadopago.py @@ -10,9 +10,10 @@ from requests.adapters import HTTPAdapter from requests.packages.urllib3.poolmanager import PoolManager -import ssl import platform +import ssl +import sys class MPSSLAdapter(HTTPAdapter): def init_poolmanager(self, connections, maxsize, block=False): @@ -321,7 +322,7 @@ def __init__(self, outer): self.__outer = outer self.USER_AGENT = "MercadoPago Python SDK v"+self.__outer.version self.PRODUCT_ID = "bc32bpftrpp001u8nhlg" - self.TRACKING_ID = "platform:"+platform.python_version()+",type:SDK"+self.__outer.version+",so;" + self.TRACKING_ID = "platform:"+str(sys.version_info.major)+"|"+platform.python_version()+",type:SDK"+self.__outer.version+",so;" def get_mercadopago_transport_adapter(self): """Creates and returns the transport adaptor for MP""" diff --git a/setup.py b/setup.py index 92fc8d8..c4b2c31 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def run(self): setup( name='mercadopago', - version='0.3.5', + version='1.1.0', author='Horacio Casatti ', author_email='horacio.casatti@mercadolibre.com', keywords='api mercadopago checkout payment ipn sdk integration', From 1778675f0bb85cf3dda297f00139f637bf164f48 Mon Sep 17 00:00:00 2001 From: Danilo Elias Date: Tue, 21 Jan 2020 08:42:16 -0300 Subject: [PATCH 3/4] Adding LICENSE --- LICENSE | 21 +++++++++++++++++++++ MANIFEST.in | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..395313a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 MercadoPago Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index c4bf456..b1eaf85 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ -include README.rst \ No newline at end of file +include README.rst +include LICENSE \ No newline at end of file From 52ef8ba76ff18af6a034bec4185f2055a2bb2e54 Mon Sep 17 00:00:00 2001 From: Danilo Elias Date: Tue, 21 Jan 2020 09:13:06 -0300 Subject: [PATCH 4/4] Changing version --- mercadopago/mercadopago.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mercadopago/mercadopago.py b/mercadopago/mercadopago.py index 510106a..c243d04 100644 --- a/mercadopago/mercadopago.py +++ b/mercadopago/mercadopago.py @@ -33,7 +33,7 @@ class MPInvalidCredentials(MPException): class MP(object): - version = "1.1.0" + version = "1.1.1" __access_data = None __ll_access_token = None __sandbox = False diff --git a/setup.py b/setup.py index c4b2c31..facbfee 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def run(self): setup( name='mercadopago', - version='1.1.0', + version='1.1.1', author='Horacio Casatti ', author_email='horacio.casatti@mercadolibre.com', keywords='api mercadopago checkout payment ipn sdk integration',