Skip to content Skip to sidebar Skip to footer

Pass (optional) Parameters To Http Parameter (python, Requests)

I am currently working on an API Wrapper, and I have an issue with passing the parameters from a function, into the payload of requests. The parameters can be blockId, senderId, re

Solution 1:

Shortest one:

PARAMS = ['blockid', 'senderid', 'recipientid', 'limit', 'offset', 'orderby']
payload = {name: eval(name) for name in PARAMS if eval(name) is not None}

Post a Comment for "Pass (optional) Parameters To Http Parameter (python, Requests)"