Skip to content

Commit

Permalink
Merge pull request #29 from mercadopago/release/1.1.0
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
delias-silva authored Jan 21, 2020
2 parents 82b1d49 + 52ef8ba commit b8a6bf9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include README.rst
include README.rst
include LICENSE
16 changes: 10 additions & 6 deletions mercadopago/mercadopago.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +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):
Expand All @@ -31,7 +33,7 @@ class MPInvalidCredentials(MPException):


class MP(object):
version = "0.3.4"
version = "1.1.1"
__access_data = None
__ll_access_token = None
__sandbox = False
Expand Down Expand Up @@ -319,6 +321,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:"+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"""
Expand All @@ -335,7 +339,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,
Expand All @@ -349,7 +353,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,
Expand All @@ -363,7 +367,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,
Expand All @@ -374,7 +378,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,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def run(self):

setup(
name='mercadopago',
version='0.3.5',
version='1.1.1',
author='Horacio Casatti <horacio.casatti@mercadolibre.com>',
author_email='horacio.casatti@mercadolibre.com',
keywords='api mercadopago checkout payment ipn sdk integration',
Expand Down

0 comments on commit b8a6bf9

Please sign in to comment.