Subprocess management: use a decorator
Use a decorator instead of a mixin to handle subprocess spawning and monitoring
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# HACK: seems 'requests' module bundled with blender isn't bundled with 'idna' module. So force system python for now
|
||||
# import sys
|
||||
# sys.path.insert(0, '/usr/lib/python3.6/site-packages')
|
||||
import sys
|
||||
sys.path.insert(0, '/usr/lib/python3.6/site-packages')
|
||||
|
||||
from pathlib import Path
|
||||
import requests
|
||||
@@ -56,10 +56,15 @@ class Repository:
|
||||
req_headers = {}
|
||||
|
||||
# Do things this way to avoid adding empty objects/None to the req_headers dict
|
||||
if 'etag' in self._headers:
|
||||
req_headers['If-None-Match'] = self._headers['etag']
|
||||
if 'last-modified' in self._headers:
|
||||
req_headers['If-Modified-Since'] = self._headers['last-modified']
|
||||
if self._headers:
|
||||
try:
|
||||
req_headers['If-None-Match'] = self._headers['etag']
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
req_headers['If-Modified-Since'] = self._headers['last-modified']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
#try
|
||||
resp = requests.get(self.url, headers=req_headers)
|
||||
|
Reference in New Issue
Block a user