MCPcopy
hub / github.com/psf/requests / CustomMapping

Class CustomMapping

tests/test_requests.py:900–917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

898
899 def test_post_with_custom_mapping(self, httpbin):
900 class CustomMapping(MutableMapping):
901 def __init__(self, *args, **kwargs):
902 self.data = dict(*args, **kwargs)
903
904 def __delitem__(self, key):
905 del self.data[key]
906
907 def __getitem__(self, key):
908 return self.data[key]
909
910 def __setitem__(self, key, value):
911 self.data[key] = value
912
913 def __iter__(self):
914 return iter(self.data)
915
916 def __len__(self):
917 return len(self.data)
918
919 data = CustomMapping({"some": "data"})
920 url = httpbin("post")

Callers 1

Calls

no outgoing calls

Tested by 1