mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-09 09:59:51 +01:00
Properly handle extra source files
This commit is contained in:
parent
b15eb1031d
commit
03bf5e618f
@ -1,7 +1,13 @@
|
||||
import json
|
||||
import pkgutil
|
||||
|
||||
categories = json.load(open('data/categories.json'))
|
||||
sorts = json.load(open('data/sorts.json'))
|
||||
|
||||
def get_resource(filename):
|
||||
return pkgutil.get_data(__package__, 'data/' + filename)
|
||||
|
||||
|
||||
categories = json.loads(get_resource('categories.json').decode())
|
||||
sorts = json.loads(get_resource('sorts.json').decode())
|
||||
|
||||
default_headers = {'User-Agent': 'pirate get'}
|
||||
default_timeout = 10
|
||||
|
Loading…
Reference in New Issue
Block a user