Skip to content

Commit

Permalink
Fixed a bug with request's params
Browse files Browse the repository at this point in the history
  • Loading branch information
arzkar committed Apr 22, 2021
1 parent 721ebf4 commit 3919240
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fichub_cli/fichub.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ def get_fic_metadata(url, format_type, debug,
'User-Agent': 'fichub_cli/0.3.1',
}

params = {'q': url}
if automated: # for internal testing
headers['automated'] = 'true'
params['automated'] = 'true'

response = requests.get(
"https://fichub.net/api/v0/epub", params={'q': url},
"https://fichub.net/api/v0/epub", params=params,
allow_redirects=True, headers=headers
).json()

Expand Down Expand Up @@ -59,10 +60,11 @@ def get_fic_data(download_url, automated=False):
'User-Agent': 'fichub_cli/0.3.1',
}

params = {}
if automated: # for internal testing
headers['automated'] = 'true'
params['automated'] = 'true'

data = requests.get(
download_url, allow_redirects=True, headers=headers).content
download_url, allow_redirects=True, headers=headers, params=params).content

return data

0 comments on commit 3919240

Please sign in to comment.