Skip to content

Commit b8a6bf9

Browse files
authored
Merge pull request #29 from mercadopago/release/1.1.0
Release 1.1.0
2 parents 82b1d49 + 52ef8ba commit b8a6bf9

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 MercadoPago Developers
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
include README.rst
1+
include README.rst
2+
include LICENSE

mercadopago/mercadopago.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
from requests.adapters import HTTPAdapter
1212
from requests.packages.urllib3.poolmanager import PoolManager
13-
import ssl
1413

14+
import platform
15+
import ssl
16+
import sys
1517

1618
class MPSSLAdapter(HTTPAdapter):
1719
def init_poolmanager(self, connections, maxsize, block=False):
@@ -31,7 +33,7 @@ class MPInvalidCredentials(MPException):
3133

3234

3335
class MP(object):
34-
version = "0.3.4"
36+
version = "1.1.1"
3537
__access_data = None
3638
__ll_access_token = None
3739
__sandbox = False
@@ -319,6 +321,8 @@ class __RestClient(object):
319321
def __init__(self, outer):
320322
self.__outer = outer
321323
self.USER_AGENT = "MercadoPago Python SDK v"+self.__outer.version
324+
self.PRODUCT_ID = "bc32bpftrpp001u8nhlg"
325+
self.TRACKING_ID = "platform:"+str(sys.version_info.major)+"|"+platform.python_version()+",type:SDK"+self.__outer.version+",so;"
322326

323327
def get_mercadopago_transport_adapter(self):
324328
"""Creates and returns the transport adaptor for MP"""
@@ -335,7 +339,7 @@ def get_session(self):
335339

336340
def get(self, uri, params=None):
337341
s = self.get_session()
338-
api_result = s.get(self.__API_BASE_URL+uri, params=params, headers={'User-Agent':self.USER_AGENT, 'Accept':self.MIME_JSON})
342+
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})
339343

340344
response = {
341345
"status": api_result.status_code,
@@ -349,7 +353,7 @@ def post(self, uri, data=None, params=None, content_type=MIME_JSON):
349353
data = JSONEncoder().encode(data)
350354

351355
s = self.get_session()
352-
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})
356+
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})
353357

354358
response = {
355359
"status": api_result.status_code,
@@ -363,7 +367,7 @@ def put(self, uri, data=None, params=None, content_type=MIME_JSON):
363367
data = JSONEncoder().encode(data)
364368

365369
s = self.get_session()
366-
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})
370+
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})
367371

368372
response = {
369373
"status": api_result.status_code,
@@ -374,7 +378,7 @@ def put(self, uri, data=None, params=None, content_type=MIME_JSON):
374378

375379
def delete(self, uri, params=None):
376380
s = self.get_session()
377-
api_result = s.delete(self.__API_BASE_URL+uri, params=params, headers={'User-Agent':self.USER_AGENT, 'Accept':self.MIME_JSON})
381+
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})
378382

379383
response = {
380384
"status": api_result.status_code,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def run(self):
2525

2626
setup(
2727
name='mercadopago',
28-
version='0.3.5',
28+
version='1.1.1',
2929
author='Horacio Casatti <[email protected]>',
3030
author_email='[email protected]',
3131
keywords='api mercadopago checkout payment ipn sdk integration',

0 commit comments

Comments
 (0)