Skip to content

Commit

Permalink
feat: can send custom HTTP headers
Browse files Browse the repository at this point in the history
  • Loading branch information
louistiti committed Apr 7, 2019
1 parent ab8a15e commit 2685cda
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bridges/python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ def output(type, code, speech = ''):
if (type == 'inter'):
stdout.flush()

def http(method, url):
def http(method, url, headers = None):
"""Send HTTP request with the Leon user agent"""

session = requests.Session()
session.headers.update({ 'User-Agent': useragent, 'Cache-Control': 'no-cache' })

if headers != None:
session.headers.update(headers)

return session.request(method, url)

def config(key):
Expand Down

0 comments on commit 2685cda

Please sign in to comment.