EDIT - as per your first comment and extra requirements: Unfortunately I do not think it is possible to get watchers over time, you can however get the stargazers over time, an example using GitHub's GraphQL API is below. To do so you can use the following:
import requests
MY_TOKEN = my_token
REPO_NAME = repo_name
REPO_OWNER = repo_owner
query = f'''{{
repository(name: "{REPO_NAME}", owner: "{REPO_OWNER}") {{
watchers {{
totalCount
}}
stargazers(first: 100) {{
totalCount
edges {{
starredAt
}}
}}
}}
}}
'''
headers = {"Authorization": f"token {MY_TOKEN}"}
request = requests.post("https://api.github.com/graphql", json={"query": query}, headers=headers)
print(request.json())
Which will output a result like the following:
{
"data": {
"repository": {
"watchers": {
"totalCount": 1594
},
"stargazers": {
"totalCount": 53952,
"edges": [
{
"starredAt": "2016-08-15T18:39:55Z"
},
{
"starredAt": "2016-08-15T19:14:32Z"
}
]
}
}
}
}
You can easily try out GitHub's GraphQL API in the explorer they provide (one click to run a query). Just use the following query as an example (and replace the repo name and owner as you wish):
{
repository(name: "repo_name", owner: "repo_owner") {
watchers {
totalCount
}
stargazers(first:100) {
totalCount
edges {
starredAt
}
}
}
}
Note you should now be careful for pagination (see first:... parameter).