Skip to content

Commit

Permalink
figshare.issue_request: Pass params to requests (iss cognoma#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
astrochun committed Mar 26, 2020
1 parent 0534745 commit b2148da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions figshare/figshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import os
from urllib.request import urlretrieve

def issue_request(method, url, headers, data=None, binary=False):

def issue_request(method, url, headers, data=None, binary=False,
params=None):
"""Wrapper for HTTP request
Parameters
Expand All @@ -24,6 +26,9 @@ def issue_request(method, url, headers, data=None, binary=False):
binary: bool
Whether data is binary or not
params: dict
Additional information for URL GET request
Returns
-------
response_data: dict
Expand All @@ -32,7 +37,8 @@ def issue_request(method, url, headers, data=None, binary=False):
if data is not None and not binary:
data = json.dumps(data)

response = requests.request(method, url, headers=headers, data=data)
response = requests.request(method, url, headers=headers,
data=data, params=params)

try:
response.raise_for_status()
Expand Down

0 comments on commit b2148da

Please # to comment.