Skip to content

Commit

Permalink
remove dependencies: requests, tqdm
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Sep 15, 2024
1 parent 0956343 commit 7f68e46
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 91 deletions.
82 changes: 1 addition & 81 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ authors = [
{name = "yzqzss", email = "[email protected]"},
]
dependencies = [
"requests",
"tqdm",
"httpx",
]
requires-python = ">=3.12"
Expand Down
14 changes: 6 additions & 8 deletions src/fdroid_push_swh/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import asyncio
import logging
import requests
from pathlib import Path
import json
import tqdm
import argparse

import httpx

from fdroid_push_swh.swh import git_swh

json_url = 'https://f-droid.org/repo/index-v2.json'
Expand All @@ -26,14 +26,12 @@ async def main():
with json_cache.open('rb') as f:
data = json.load(f)
else:
r = requests.get(json_url, stream=True)
print('Downloading index-v2.json...')
r = httpx.get(json_url, follow_redirects=True)
r.raise_for_status()
_data = b''
for chunk in tqdm.tqdm(r.iter_content(chunk_size=1024 * 1024), unit='chunk', unit_scale=True):
_data += chunk
with json_cache.open('wb') as f:
f.write(_data)
data: dict = json.loads(_data)
f.write(r.content)
data: dict = json.loads(r.content)
print(len(data)//1024//1024, 'MiB')
packages = data.get('packages', {})

Expand Down

0 comments on commit 7f68e46

Please sign in to comment.