koalalorenzo / python-digitalocean

🐍🐳 Python module to manage Digital Ocean droplets
GNU Lesser General Public License v3.0
1.26k stars 301 forks source link

Added request.Session usage #268

Closed ZuluPro closed 5 years ago

ZuluPro commented 5 years ago

This was using the high-level method available in requests.

Instead of that, here we use a Session object with exactly the same methods. The difference is that I'm storing this object as class attribute of BaseAPI and users could:

ZuluPro commented 5 years ago

@koalalorenzo Any news ?

ZuluPro commented 5 years ago

Hello @koalalorenzo Any news ?

koalalorenzo commented 5 years ago

How can we test this? I need proper specific tests that are validating one or more of your assumptions (Handlers, Retry, Timeouts etc etc).

That will work as an example for new users.

ZuluPro commented 5 years ago

Write new tests, I don't know because current tests fill the coverage requirements.

But I can write some examples of Session customization.

ZuluPro commented 5 years ago

@koalalorenzo Hi I added doc in the README, maybe not perfect, do not hesitate to say to me. ;)

koalalorenzo commented 5 years ago

Sorry, I can’t merge without some tests validating what you just implemented.

Please add some tests

ZuluPro commented 5 years ago

Hello @koalalorenzo I added a test customizing the session.

I was a bit hard to test because:

I did the trick with the proxy feature πŸ‘ But in facts, I wrote this test but I didn't change the API, so new tests are really useful.

I think the session usage could ease several things: