Skip to content

Commit

Permalink
Merge pull request #40 from letsbuilda/gh39
Browse files Browse the repository at this point in the history
Remove file handling and raw HTTP request handlers
  • Loading branch information
shenanigansd authored Jul 21, 2023
2 parents f5999d3 + 0e77f1f commit 5b55df6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 50 deletions.
3 changes: 3 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
Changelog
=========

- :release:`5.0.0 <21st July 2023>`
- :feature:`39` Remove file handling

- :release:`4.0.0 <25th April 2023>`
- :feature:`18` Use a single function to get versioned package metadata

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[project]
name = "letsbuilda-pypi"
version = "5.0.0b2"
version = "5.0.0b3"
description = "A wrapper for PyPI's API and RSS feed"
authors = [
{ name = "Bradley Reynolds", email = "bradley.reynolds@darbia.dev" },
]
license = { text = "MIT" }
readme = "README.md"
requires-python = ">=3.11.4"
requires-python = ">=3.11"
dependencies = [
"requests",
"xmltodict",
Expand Down
12 changes: 0 additions & 12 deletions src/letsbuilda/pypi/async_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""The async client."""

from http import HTTPStatus
from io import BytesIO
from typing import Final, Self

import xmltodict
Expand Down Expand Up @@ -54,14 +53,3 @@ async def get_package_metadata(
) -> Package:
"""Get metadata for a package."""
return Package.from_json_api_data(await self.get_package_json_metadata(package_title, package_version))

async def fetch_bytes(
self: Self,
url: str,
) -> BytesIO:
"""Fetch bytes from a URL."""
buffer = BytesIO()
async with self.http_session.get(url) as response:
buffer.write(await response.content.read())
buffer.seek(0)
return buffer
25 changes: 0 additions & 25 deletions src/letsbuilda/pypi/files.py

This file was deleted.

11 changes: 0 additions & 11 deletions src/letsbuilda/pypi/sync_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""The sync client."""

from http import HTTPStatus
from io import BytesIO
from typing import Final, Self

import xmltodict
Expand Down Expand Up @@ -48,13 +47,3 @@ def get_package_metadata(
) -> Package:
"""Get metadata for a package."""
return Package.from_json_api_data(self.get_package_json_metadata(package_title, package_version))

def fetch_bytes(
self: Self,
url: str,
) -> BytesIO:
"""Fetch bytes from a URL."""
response = self.http_session.get(url)
buffer = BytesIO(response.content)
buffer.seek(0)
return buffer

0 comments on commit 5b55df6

Please sign in to comment.