sendgrid / python-http-client

Twilio SendGrid's Python HTTP Client for calling APIs
https://sendgrid.com
MIT License
126 stars 101 forks source link

Would be handy if Client was pickleable #18

Closed jturmel closed 6 years ago

jturmel commented 7 years ago

Using the Sendgrid Python lib (and sgbackend lib) which depends on this library (within Django), sending tasks to a background queue that first pickles the Mail being sent out, due to how Django attached the connection (backend) to each Mail object, it has an instance of the Client on it. It then pickles it to store it for the task queue and fails because pickle.dumps doesn't like the Client object, I think because getitem is overrode, so from what I can tell you just need to define setstate and getstate on Client's implementation.

thinkingserious commented 7 years ago

Thanks for the suggestion @jturmel,

I have added this to our backlog. It can increase priority with additional votes or a PR.

With Best Regards,

Elmer

jussih commented 7 years ago

I will take a look at this