Skip to content

Commit

Permalink
remove 'extracts' from base_url
Browse files Browse the repository at this point in the history
  • Loading branch information
renae-r committed Apr 30, 2024
1 parent dc6457b commit 1c7ad2d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/ipumspy/api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class IpumsApiClient:
def __init__(
self,
api_key: str,
base_url: str = "https://api.ipums.org/extracts",
base_url: str = "https://api.ipums.org",
api_version: str = 2,
num_retries: int = 3,
session: Optional[requests.Session] = None,
Expand Down Expand Up @@ -176,7 +176,7 @@ def submit_extract(
if extract.api_version is None:
extract.api_version = self.api_version
response = self.post(
self.base_url,
f"{self.base_url}/extracts",
params={"collection": extract.collection, "version": extract.api_version},
json=extract.build(),
)
Expand Down Expand Up @@ -210,7 +210,7 @@ def extract_status(

try:
response = self.get(
f"{self.base_url}/{extract_id}",
f"{self.base_url}/extracts/{extract_id}",
params={"collection": collection, "version": self.api_version},
)
except IpumsNotFound:
Expand Down Expand Up @@ -277,7 +277,7 @@ def download_extract(
)

response = self.get(
f"{self.base_url}/{extract_id}",
f"{self.base_url}/extracts/{extract_id}",
params={"collection": collection, "version": self.api_version},
)

Expand Down Expand Up @@ -393,7 +393,7 @@ def get_previous_extracts(self, collection: str, limit: int = 10) -> List[Dict]:
"""
# TODO: Wrap results in Extract objects.
output = self.get(
self.base_url,
f"{self.base_url}/extracts",
params={
"collection": collection,
"pageSize": limit,
Expand Down Expand Up @@ -425,7 +425,7 @@ def get_extract_info(
return extract._info
else:
extract_info = self.get(
f"{self.base_url}/{extract_id}",
f"{self.base_url}/extracts/{extract_id}",
params={"collection": collection, "version": self.api_version},
).json()
new_line = "\n"
Expand Down Expand Up @@ -500,7 +500,7 @@ def _get_pages(
# made this a private method looking forward to making this a more
# general purpose generator for non-extract endpoints
first_page = self.get(
self.base_url,
f"{self.base_url}/extracts",
params={
"collection": collection,
"version": self.api_version,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def mock_api() -> str:
)
time.sleep(1) # Give it enough time to warm up
try:
yield "http://127.0.0.1:8989/extracts"
yield "http://127.0.0.1:8989"
finally:
p.kill()

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def mock_api() -> str:
)
time.sleep(1) # Give it enough time to warm up
try:
yield "http://127.0.0.1:9898/extracts"
yield "http://127.0.0.1:9898"
finally:
p.kill()

Expand Down

0 comments on commit 1c7ad2d

Please sign in to comment.