Skip to content

Commit

Permalink
Use in-memory HTTP requests cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Sep 17, 2019
1 parent 4207c4e commit 1d05ae3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

0.0.14
~~~~~~

- Use in-memory HTTP requests cache.

0.0.13 (2019-08-29)
~~~~~~~~~~~~~~~~~~~

Expand Down
3 changes: 3 additions & 0 deletions ocdsextensionregistry/extension_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
from urllib.parse import urlparse

import requests
import requests_cache

from .extension import Extension
from .extension_version import ExtensionVersion
from .exceptions import DoesNotExist, MissingExtensionMetadata

requests_cache.install_cache(backend='memory')


class ExtensionRegistry:
def __init__(self, extension_versions_data, extensions_data=None):
Expand Down
3 changes: 3 additions & 0 deletions ocdsextensionregistry/extension_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
from zipfile import ZipFile

import requests
import requests_cache

from .codelist import Codelist
from .exceptions import NotAvailableInBulk
from .util import json_loads

SCHEMAS = ('record-package-schema.json', 'release-package-schema.json', 'release-schema.json')

requests_cache.install_cache(backend='memory')


class ExtensionVersion:
def __init__(self, data):
Expand Down
2 changes: 2 additions & 0 deletions ocdsextensionregistry/profile_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@

import json_merge_patch
import requests
import requests_cache

from .codelist import Codelist
from .extension_registry import ExtensionRegistry
from .extension_version import ExtensionVersion
from .util import json_loads

logger = logging.getLogger('ocdsextensionregistry')
requests_cache.install_cache(backend='memory')


class ProfileBuilder:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
install_requires=[
'json-merge-patch',
'requests',
'requests-cache',
],
extras_require={
'test': [
Expand Down

0 comments on commit 1d05ae3

Please sign in to comment.