Move web application in a separate module
This commit is contained in:
15
utils.py
Normal file
15
utils.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import requests
|
||||
import os
|
||||
|
||||
def http_get(url):
|
||||
response = requests.get(url);
|
||||
if response.status_code == 200:
|
||||
pass
|
||||
else:
|
||||
print('Uh, oh, unable to fetch', url)
|
||||
print('Http status code:', response.status_code)
|
||||
raise Error('Download error')
|
||||
return response
|
||||
|
||||
def project_dir():
|
||||
return os.path.dirname(__file__)
|
||||
Reference in New Issue
Block a user