Package: mercadolibre-client
Mercado Libre Python API Client (unoffical)This client is developed and maintened
byMercado Radar.If you have improvements or suggestions, feel free to open a Pull Request
onhttps://github.com/mercadoradar/mercadolibre-clientFirst StepsSet your app configuration in environment variables as follows:MERCADO_LIBRE_APP_CLIENT_IDMERCADO_LIBRE_APP_CLIENT_SECRET
MERCADO_LIBRE_REDIRECT_URIAuthenticationBrowse
to `http://auth.mercadolibre.com.ar/authorization?response_type=code&client_id={MERCADO_LIBRE_APP_CLIENT_ID}&redirect_uri={MERCADO_LIBRE_REDIRECT_URI}Pass the query paramcodeto theOAuth().authenticate()methodfrommercadolibre.OAuthimportOAuth...response=OAuth().authenticate(code=code)This will return you anaccess_tokenandrefresh_tokenthat should be managed and stored by your applicationToprivate requestsyou should always include theaccess_tokenandrefresh_tokenwhen initiate the
MercadoLibreAPIself.mercadolibre=MercadoLibreAPI(access_token=access_token,refresh_token=refresh_token)self.mercadolibre.Item().get(id="MLB123456789")The client will try to make the private request with the givenaccess_token.If it fails because of token expired, it will try to update the token for you using therefresh_tokenprovidedIf it fails again, then it will return errorIf there is no need to update theaccess_tokenit will returntokens = Noneso you don't need to update nothingIf the client get a new token, it will be returned to you along with the request response as below:self.mercadolibre=MercadoLibreAPI(access_token=access_token,refresh_token=refresh_token)response,tokens=self.mercadolibre.Item().get(id="MLB123456789")Public RequestsDo not need anaccess_tokenandrefresh_tokenMercadoLibreAPI().Item().get(id="MLB123456789")Private RequestsRequests that need authentication, mandatoryaccess_tokenandrefresh_tokenaccess_token: stringrefresh_token: stringfrommercadolibreimportMercadoLibreAPI...self.mercadolibre=MercadoLibreAPI(access_token=access_token,refresh_token=refresh_token)self.mercadolibre.Item().get(id="MLB123456789")...ResourcesItemsCreate ItemItem().create(data)data: dictGet Item By Id:Item().get(id)id: stringMulti-get Items By Id:Item().Item(id)ids: list of stringGet item description:Item().get_description(id)id: stringUpdate:Item().update(id, data)id: stringdata: dictUpdate Description:Item().update_description(id, description)id: stringdescription: stringOrdersGet Order By Id:Order().get(id)id: stringQuestionsGet Question By Id:Question().get(id)id: stringWant to contribute?Feel free to code and open a Pull Request.LicenceMIT LicenseCopyright (c) 2021 Mercado RadarPermission 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.