Cache

XbrlXML.Cache.HttpCacheType
HttpCache(cache_dir="./cache/", headers=Dict())

Create a cache to store files locally for reuse.

headers are passed to http Downloads.download. Services such as SEC require you to disclose information about your application.

Example

julia> using XbrlXML

julia> cache = HttpCache("/Users/user/cache/")
/Users/user/cache/
source
XbrlXML.Cache.cache_edgar_enclosureMethod
cache_edgar_enclosure(cache::HttpCache, enclosure_url)

Cache the zip folder from SEC containing all XBRL related files for a given submissions.

Due to the fact that the zip compression is very effective on xbrl submissions that naturally contain repeating text, it is way more efficient to download the zip folder and extract it. This will most often be the most efficient method for downloading the submission. One way to get the zip enclosure url is through the Structured Disclosure RSS Feeds provided by the SEC: https://www.sec.gov/structureddata/rss-feeds-submitted-filings

source
XbrlXML.Cache.cachedirMethod
cachedir(cache::HttpCache)::String

Return the local directory of a cache.

Example

julia> using XbrlXML

julia> cache = HttpCache("/Users/user/cache/");

julia> cachedir(cache)
"/Users/user/cache/"
source
XbrlXML.Cache.find_entry_fileMethod
find_entry_file(cache::HttpCache, dirpath::String)::Union{String,Nothing}

Find the most likely entry file in provided filing directory.

This function only works for enclosed SEC submissions that where already downloaded. Will return only the most likely file path for the instance document.

source
XbrlXML.Cache.header!Method
header!(cache::HttpCache, header::Pair)::Dict

Add a header pair to a cache and return the headers.

Example

julia> using XbrlXML

julia> cache = HttpCache("/Users/user/cache/");

julia> header!(cache, "User-Agent" => "You youremail@domain.com")
Dict{String, String} with 1 entry:
  "User-Agent" => "You youremail@domain.com"
source
XbrlXML.Cache.headers!Method
headers!(cache::HttpCache, header::Vector{Pair})::Dict

Add multiple header pairs to a cache and return the headers.

Example

julia> using XbrlXML

julia> cache = HttpCache("/Users/user/cache/");

julia> newheaders = ["User-Agent" => "You youremail@domain.com", "From" => "You"];

julia> headers!(cache, newheaders)
Dict{String, String} with 2 entries:
  "From"       => "You"
  "User-Agent" => "You youremail@domain.com"
source
XbrlXML.Cache.headersMethod
headers(cache::HttpCache)::Dict

Return the headers of a cache.

Example

julia> using XbrlXML

julia> cache = HttpCache("/Users/user/cache/");

julia> header!(cache, "User-Agent" => "You youremail@domain.com");

julia> headers(cache)
Dict{String, String} with 1 entry:
  "User-Agent" => "You youremail@domain.com"
source