Use requests.Session.
This commit is contained in:
parent
b6f801568f
commit
fb8de24a9d
1 changed files with 3 additions and 1 deletions
|
@ -83,6 +83,8 @@ sql = sqlite3.connect('pixelcanvas.db')
|
|||
cur = sql.cursor()
|
||||
cur.executescript(DB_INIT)
|
||||
|
||||
session = requests.Session()
|
||||
|
||||
# HELPER FUNCTIONS
|
||||
################################################################################
|
||||
def now():
|
||||
|
@ -153,7 +155,7 @@ def url_for_bigchunk(bigchunk_x, bigchunk_y):
|
|||
return f'http://api.pixelcanvas.io/api/bigchunk/{bigchunk_x}.{bigchunk_y}.bmp'
|
||||
|
||||
def request(url):
|
||||
response = requests.get(url)
|
||||
response = session.get(url)
|
||||
response.raise_for_status()
|
||||
return response
|
||||
|
||||
|
|
Loading…
Reference in a new issue