Skip to content

Commit

Permalink
workaround for pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
deeleeramone committed May 18, 2024
1 parent 787da80 commit 177a262
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 58 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""FMP Equity Screener Model."""

# pylint: disable=unused-argument

from copy import deepcopy
from typing import Any, Dict, List, Literal, Optional

import pandas as pd
Expand Down Expand Up @@ -165,13 +165,14 @@ async def aextract_data(
) -> List[Dict]:
"""Return the raw data from the FMP endpoint."""
api_key = credentials.get("fmp_api_key") if credentials else ""
if query.sector is not None:
query.sector = query.sector.replace("_", " ").title()
_query = deepcopy(query)
if _query.sector is not None:
_query.sector = _query.sector.replace("_", " ").title()
url = create_url(
version=3,
endpoint="stock-screener",
api_key=api_key,
query=query,
query=_query,
exclude=["query", "is_symbol", "industry"],
).replace(" ", "%20")
return await get_data(url, **kwargs) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,69 +3,72 @@ interactions:
body: null
headers:
Accept:
- '*/*'
- application/json
Accept-Encoding:
- gzip, deflate, br
- gzip, deflate
Connection:
- keep-alive
method: GET
uri: https://financialmodelingprep.com/api/v3/stock-screener?apikey=MOCK_API_KEY&betaLowerThan=0.5&isActivelyTrading=True&isEtf=False&limit=50000&sector=Energy
response:
body:
string: !!binary |
H4sIAAAAAAAAA9Wc226j3BXH77+nQHMxvZnZ2kc29M52nIMmdlxDMvlU9YKxmQQFgws4M1bV92mf
43uxLpyAp7A3PnS7SiJFSsAQ2D/W4b/WIn/9zbL+Ad+W9SFfL76l8Yc/Wx8G/rT34dPL1lm6WAbJ
ehwsws2utAizLLCGSZg9rK2rZIaqTy6C7CksBsESPkextJm0Bef4dW8ezoo0K0/xcmh1VJTMV3mR
rcs9N1FsfbQugtwafpxUH/gWFgHsxIhR+3XTMotm5dVQicTrpjjIi16SrIL4LHqO5mEy3xzjvO5+
TuPV5gakywl35Ovm8OfsMUgeNnc2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mnp6fKzXBoUjrqXYxqGVtCciqNSGXNGe3
VWr5uMhfo4CbU9kV2tG4d25/jvFMC4YjfRWpM9e/jf/4X5bEof5t/vfew8c//ps67ywPNELRVkS0
BIhqrUdadjvN5aXadIYJ3l/+McbT0ZEt5T2N5nGk0sD/MvEtIkuDtsCCEoR27DduHb0gqs5j4Jat
YigF5qZRjD3Gr9Oj7hF6R2NbjuwtF/pS4qQcKStWtOlZEoEkkrDLBBngam+ydYyT+hYzGdwe2W3p
Lb+J3dXple2Bkqvg0b+PkwZQ+VeACNmm/reDnRFWL7wj0U7SM1LOCnQk6A/BajC0mdnAf/ioippt
AzBAAcQ7RrEtgb3TdCQn3FBt57idIKEMMg6+hw7J4MO1jdyHa+fMj+ZNDwMJRBmXHRegAKp/nYIr
G+c16mYmOo5mh2DVtz7t3feT6JMKQ01qtdSBaqKmmUFZlvA6ogZZ1c6QSzeUDev9f4iRNPnHV0bu
vDcZ24aytW/PZzfGaiX4i+8AMoF7fu5uNx/Z9JUKVcVBNuVnLql3H5E0gjp4Xv0tGdqvw4ufbY8d
b9PlQhBI1MYbbt3iAm3bjpxL47TnwXlsazc//Ov/64YFR2VQAAA=
headers:
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Headers:
- X-Requested-With, content-type, auth-token, Authorization, stripe-signature,
APPS
APPS, publicauthkey, privateauthkey
Access-Control-Allow-Methods:
- GET, POST, OPTIONS
Access-Control-Allow-Origin:
Expand All @@ -79,9 +82,9 @@ interactions:
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 01 Nov 2023 03:52:34 GMT
ETag:
- W/"4982-+8Qdcwj1qb7/EmFCGB+B5c50150"
- Sat, 18 May 2024 00:53:55 GMT
Etag:
- W/"5065-ZEn6rIEbJjPKIDVPjFO8zIEy3jg"
Server:
- nginx/1.18.0 (Ubuntu)
Transfer-Encoding:
Expand Down
2 changes: 1 addition & 1 deletion openbb_platform/providers/fmp/tests/test_fmp_fetchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def test_fmp_equity_quote_fetcher(credentials=test_credentials):
@pytest.mark.record_http
def test_fmp_equity_screener_fetcher(credentials=test_credentials):
"""Test FMP equity screener fetcher."""
params = {"query": "midstream", "sector": "energy", "beta_max": 0.5}
params = {"industry": "midstream", "sector": "energy", "beta_max": 0.5}

fetcher = FMPEquityScreenerFetcher()
result = fetcher.test(params, credentials)
Expand Down

0 comments on commit 177a262

Please sign in to comment.