edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

Not able to call Company("<some stock ticker>") - Both data sources are unavailable

Open happydebugcow opened this issue 1 year ago • 6 comments

Issue Type

  • [ ] Data Quality Issue (incorrect financial values, missing data)
  • [ ] XBRL Parsing Issue (statement rendering, concept mapping)
  • [X] Filing Access Issue (download failures, attachment problems)
  • [ ] Performance Issue (slow operations, memory problems)
  • [ ] Compatibility Issue (platform/dependency conflicts)
  • [X] Documentation Issue (unclear instructions, missing examples)

Environment

EdgarTools Version: (e.g., 4.35.0) Python Version: (e.g., 3.12)
Operating System: (macOS)

Bug Description

What you expected to happen: expected when calling Company("MSFT") it works like in documentation. Only way to make Company() work is to pass cik instead, however its not that handy to pass cik all the time. would love to be able to just pass ticker.

What actually happened: calling Company("MSFT") gives me:

Error message (if any):

error fetching company tickers from [https://www.sec.gov/include/ticker.txt]: Redirect response '304 Not Modified' for url 'https://www.sec.gov/include/ticker.txt'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304
Error fetching company tickers from [https://www.sec.gov/files/company_tickers.json]: Redirect response '304 Not Modified' for url 'https://www.sec.gov/files/company_tickers.json'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304
Traceback (most recent call last):
    company = Company("MSFT")

in get_cik_tickers
    raise Exception("Both data sources are unavailable")
Exception: Both data sources are unavailable.

Reproduction

Company/Ticker: any ticker.

Minimal code to reproduce:

# Paste the minimal code that reproduces the issue
from edgar import *
set_identity("firstname lastname email")

company = Company("MSFT")

This issue will be handled using EdgarTools' systematic issue resolution workflow. A reproduction test will be created to verify the fix.

happydebugcow avatar Dec 05 '25 15:12 happydebugcow

I tried using requests get the tickers directly to see if it was an edgartools problem and and it's returning a "403 Forbidden Access" status code as well.

Might be an edgar server side problem, hopefully temporary

jordanlunick avatar Dec 05 '25 18:12 jordanlunick

Thanks for testing. I have noticed an uptick in these type of errors on the SEC. I will see if we can add some reliability since we also have ticker files inside the library

dgunning avatar Dec 05 '25 19:12 dgunning

I hae the same bug, but it only showed up today for me. SEC tickers - offcial website I belive this is where the SIC data is from. Error fetching company tickers from [https://www.sec.gov/include/ticker.txt]: Redirect response '304 Not Modified' for url 'https://www.sec.gov/include/ticker.txt' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304 Error fetching company tickers from [https://www.sec.gov/files/company_tickers.json]: Redirect response '304 Not Modified' for url 'https://www.sec.gov/files/company_tickers.json' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304 A fatal error occurred for CRM: Both data sources are unavailable Traceback (most recent call last):

I'm going to try direct CIK: company = Company('789019') #MSFT Yeah, that works fine. SO teh issue is in ticker lookup.

MonopolisticInvestor avatar Dec 07 '25 13:12 MonopolisticInvestor

Classification: CRITICAL (P0 Emergency)

Thank you for this detailed bug report! This is a critical issue that blocks core functionality.

Analysis

You've identified a fundamental bug in our HTTP caching implementation. Company("MSFT") is the primary entry point documented throughout our guides, and it's completely broken when the SEC returns HTTP 304 "Not Modified" responses.

Root Cause: Our HTTP response handling doesn't properly handle HTTP 304 "Not Modified" status codes. When the SEC returns a 304 response (meaning "your cached copy is still valid"), our code incorrectly treats this as an error rather than a valid caching response.

Impact:

  • ✅ Core functionality blocked (primary API doesn't work)
  • ✅ Beginner-hostile (users forced to know CIKs)
  • ✅ Widespread (affects all ticker-based lookups)
  • ✅ Violates our "beginner-friendly" mission

Priority & Timeline

Priority: P0 (Emergency)
Release: Point release v5.0.1 (immediate)
Timeline: 4-8 hours from this classification
Beads Issue: edgartools-4e1

This meets our criteria for an emergency point release:

  • Core functionality is blocked
  • No viable workaround for beginner users
  • Violates fundamental library principles

Workaround (Temporary)

Until v5.0.1 ships, you can use CIK directly:

from edgar import Company
company = Company(789019)  # Microsoft CIK

Or find CIK first:

from edgar.reference import find_cik
cik = find_cik("MSFT")
company = Company(cik)

Next Steps

  1. ✅ Classified as CRITICAL (P0)
  2. ✅ Created Beads issue edgartools-4e1 with external ref to #519
  3. 🔄 Implementing fix (handling HTTP 304 properly)
  4. 📋 Regression testing across platforms
  5. 🚀 Publishing v5.0.1

We'll update this issue as we progress. Thanks again for the excellent bug report with reproduction steps and environment details!

dgunning avatar Dec 07 '25 18:12 dgunning

✅ RESOLVED in v4.35.1

This critical issue has been fixed and released in version 4.35.1.

What Was Fixed

Updated inspect_response() in edgar/httprequests.py to properly handle HTTP 304 "Not Modified" responses. The function now accepts both 200 (OK) and 304 (Not Modified) as successful status codes.

Changes

Files Modified:

  • edgar/httprequests.py:774 - Accept 304 as valid response
  • edgar/__about__.py - Version bumped to 4.35.1
  • tests/issues/regression/test_issue_519_http_304.py - 7 comprehensive regression tests

Commit: 718f3bdb - "fix: Handle HTTP 304 Not Modified responses in inspect_response"

Testing

✅ All 7 new regression tests pass
✅ All 42 existing httprequests and ticker tests pass
✅ No breaking changes detected

Installation

The fix is now available on GitHub (PyPI publication pending):

pip install --upgrade edgartools

Verify the version:

import edgar
print(edgar.__version__)  # Should show 4.35.1

Timeline

  • Reported: 2025-12-05 15:49 UTC
  • Triaged as P0: 2025-12-07 13:34 UTC
  • Fix Implemented: 2025-12-07 ~14:30 UTC
  • Released: 2025-12-07 ~15:00 UTC

Total time from triage to release: ~2 hours ⚡

Release Notes

Full release notes: https://github.com/dgunning/edgartools/releases/tag/v4.35.1

Thank You!

Thank you for the excellent bug report with clear reproduction steps and environment details. This helped us identify and fix the issue quickly!

The Company(ticker) API is now working correctly with HTTP 304 responses. 🎉

dgunning avatar Dec 07 '25 18:12 dgunning

🚀 Now Live on PyPI!

Version 4.35.1 has been published to PyPI and is ready for installation!

Install Now

pip install --upgrade edgartools

Verify the installation:

import edgar
print(edgar.__version__)  # 4.35.1

Test the Fix

from edgar import Company

# This now works correctly with HTTP 304 responses!
company = Company("MSFT")
print(company.name)

Release Notes: https://github.com/dgunning/edgartools/releases/tag/v4.35.1
PyPI: https://pypi.org/project/edgartools/4.35.1/

The fix is live and ready to use! 🎉

dgunning avatar Dec 07 '25 19:12 dgunning