This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rank,installs | |
1,5000000 | |
1,5000000 | |
1,5000000 | |
1,5000000 | |
1,5000000 | |
1,5000000 | |
1,5000000 | |
1,5000000 | |
9,4000000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import os | |
import json | |
import pickle | |
def create_url(pagination_token,username): | |
# Specify the usernames that you want to lookup below | |
query = "to:" + username + "is:reply" | |
# You can enter up to 100 comma-separated values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
# see this gist https://gist.github.com/jakobgreenfeld/232ddb7894994fae9390f1cba1a73357 | |
import readsavedata | |
page = requests.get("https://www.community-finder.co/") | |
soup = BeautifulSoup(page.content, 'html.parser') | |
links = soup.find_all("a", class_="community-wrap", href=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example to get the remaining rate limit using the Github GraphQL API. | |
import datetime | |
import requests | |
import time | |
## see this gist https://gist.github.com/jakobgreenfeld/232ddb7894994fae9390f1cba1a73357 | |
import readsavedata | |
headers = {"Authorization": "Bearer INSERT_DEVELOPER_TOKEN"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the GraphQL query parameter "website" returns for posts something like "https://www.producthunt.com/r/e49de0c9ba36cf?utm_campaign=producthunt-api&utm_medium=api-v2&utm_source=Application%3A+Dead+Products+%28ID%3A+39914%29" | |
# the following python script turns it into a proper url | |
import requests | |
def unshorten_url(url): | |
return requests.head(url, allow_redirects=True).url.replace("?ref=producthunt","") | |
ur = "https://www.producthunt.com/r/e49de0c9ba36cf?utm_campaign=producthunt-api&utm_medium=api-v2&utm_source=Application%3A+Dead+Products+%28ID%3A+39914%29" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
import csv | |
# reads data from csv file | |
def read_data(filename): | |
list = [] | |
with open(filename, encoding="utf-8") as csvDataFile: | |
csvReader = csv.reader(csvDataFile) | |
for row in csvReader: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
headers = {"Authorization": "Bearer INSERT_DEVELOPERTOKEN"} | |
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section. | |
request = requests.post('https://api.producthunt.com/v2/api/graphql', json={'query': query}, headers=headers) | |
if request.status_code == 200: | |
return request.json() | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here's a minimal functioning example of how to use the producthunt GraphQL API using python. | |
# make sure to insert your own Developer Token, which you can get in the here https://www.producthunt.com/v2/oauth/applications | |
# to access different data, you need to change the query below. you can test queries in the API explorer https://ph-graph-api-explorer.herokuapp.com/ | |
# lots of further details on queries can be found here http://api-v2-docs.producthunt.com.s3-website-us-east-1.amazonaws.com/object/viewer/#user | |
import requests | |
headers = {"Authorization": "Bearer YourDeveloperToken"} | |
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section. |