Skip to content

Instantly share code, notes, and snippets.

View ItMightBlow's full-sized avatar
💭
Not much. Just time passing by

ItMightBlow

💭
Not much. Just time passing by
View GitHub Profile
@stefansundin
stefansundin / requests_api.py
Last active November 8, 2024 06:59
Reusable class for Python requests library.
# http://docs.python-requests.org/en/master/api/
import requests
class RequestsApi:
def __init__(self, base_url, **kwargs):
self.base_url = base_url
self.session = requests.Session()
for arg in kwargs:
if isinstance(kwargs[arg], dict):
kwargs[arg] = self.__deep_merge(getattr(self.session, arg), kwargs[arg])