Skip to content

Commit

Permalink
use env variable for pocketbase url
Browse files Browse the repository at this point in the history
  • Loading branch information
mfenner committed May 16, 2024
1 parent 585e636 commit 8dc0df5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions api/posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,7 @@ async def extract_all_posts_by_blog(
if not update_all:
posts = filter_updated_posts(posts, blog, key="pubDate")
if blog.get("filter", None):
print(f"Unfiltered posts: {len(posts)}")
posts = filter_posts(posts, blog, key="category")
print(f"Filtered posts: {len(posts)}")
posts = posts[start_page:end_page]
extract_posts = [extract_rss_post(x, blog) for x in posts]
blog_with_posts["entries"] = await asyncio.gather(*extract_posts)
Expand Down Expand Up @@ -1038,8 +1036,8 @@ def format_author(author, published_at):
# upsert post with commonmeta if it has a DOI
if post.get("doi", None):
id_ = id_as_str(post.get("doi"))
work = await get_single_work(id_)
print(work)
await get_single_work(id_)


return {
"authors": authors,
Expand Down
3 changes: 2 additions & 1 deletion api/works.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Optional
from os import environ
import httpx

# supported accept headers for content negotiation
Expand All @@ -17,7 +18,7 @@
async def get_single_work(string: str) -> Optional[dict]:
"""Get single work from the commonmeta API."""

url = f"https://commonmeta.org/{string}/transform/application/json"
url = f"{environ["QUART_POCKETBASE_URL"]}/{string}/transform/application/json"
try:
async with httpx.AsyncClient() as client:
response = await client.get(url)
Expand Down

0 comments on commit 8dc0df5

Please sign in to comment.