Regardless:
pathlib.Path:
- https://docs.python.org/3/library/pathlib.html
Django's class-based views and mixins:
- https://docs.djangoproject.com/en/3.1/topics/class-based-vie...
- https://docs.djangoproject.com/en/3.1/topics/class-based-vie...
Hell, you don't even need to look into other code. Just use the sample from the article.
What if client_a and client_b write to different APIs? One expects authentication, the other has pagination and rate limiting. Actually, one of them returns XML. Their URL structure is completely different.
Classes are great when you want a bunch of different things to produce a similar result. You don't care how the client fetches and transforms data, as long as it returns it in a certain format.
For example, you might want TwitterTweetSource.get_items() and FacebookPostSource.get_items() to both return a list of Posts that have certain attributes. The implementation details don't matter; you just want these methods to have the same signature, because you call [s.get_posts() for s in source_list]. Maybe you'll add FacebookCommentSource, which reuses the same authentication strategy, but on a different endpoint.