Product Hunt API wrapper for python
You can install with pip:
pip install producthunt
or from source code:
git clone repo
make local
First, initialize the ProductHunt class with your API key.
from producthunt import ProductHunt
api_key = 'YOUR_API_KEY_HERE'
ph = ProductHunt(api_key)
Fetch daily new products.
daily_products = ph.get_daily()
for product in daily_products:
print(f"ID: {product['ID']}")
print(f"Name: {product['Name']}")
print(f"Tagline: {product['Tagline']}")
Fetch the details of a specific product using its slug.
product_details = ph.get_product_details("some-product-slug")
if product_details:
print(f"Name: {product_details['Name']}")
print(f"Tagline: {product_details['Tagline']}")
print(f"Description: {product_details['Description']}")
print(f"Website: {product_details['Website']}")
else:
print("Product not found.")
Fetch posts by topic:
products = ph.get_posts_by_topic('artificial-intelligence')
for product in products:
print(f"ID: {product['ID']}")
print(f"Name: {product['Name']}")
print(f"Tagline: {product['Tagline']}")
This project is licensed under the terms of the MIT license.