Code Monkey home page Code Monkey logo

Comments (4)

akblissweb avatar akblissweb commented on June 2, 2024

Actually the current performance is pretty bad, for me its coming in about 5 seconds slower than the raw API.

This package does seem useful, it's just right now, I cannot use it at that speed. I'm using Python 3.9.

I've compared it actually in Jupyter and on a dedicated Docker system and both come back within a second using the native API in the docs.

Are you using V2 of the API ???

from mailerlite-api-python.

akblissweb avatar akblissweb commented on June 2, 2024

I just checked you are indeed using V2.

from mailerlite-api-python.

akblissweb avatar akblissweb commented on June 2, 2024

Its this line that is causing the performance issue...

api = MailerLiteApi('xxxxx')

Because I'm using it in a web page I have to run this for every request.

In Jupyter its not so bad once I've created the api object, the actual API calls come back in a reasonable time.

from mailerlite-api-python.

skoudoro avatar skoudoro commented on June 2, 2024

Hi @akblissweb,

Because I'm using it in a web page I have to run this for every request.

Can you provide an example? if you have a server running, I do not understand why you need to call api = MailerLiteApi('xxxxx') every time. I might be missing something. Can you describe more in detail your pipeline?

To be faster:

  • you do not need to instantiate all the objects. This is what api = MailerLiteApi('xxxxx') is doing because it is convenient. You can just pick what you really need. For example, if you need only the campaign on a specific webpage, just do from mailerlite.campaign import Campaigns; c = Campaigns('xxxxx').
  • You can return only the JSON object in each function instead of the convenient custom nametuple/dataclass. When you make a call, add the parameter as_json=True. It should be faster and give you the raw JSON to do whatever you want.

Also, any other suggestions/ideas/contributions are welcomed.

Thank you for the feedback

from mailerlite-api-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.