File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 6565 run : |
6666 ./scripts/1-fetch/github_fetch.py \
6767 --enable-save --enable-git
68+ env :
69+ GH_TOKEN : ${{ secrets.BOT_TOKEN }}
Original file line number Diff line number Diff line change 11# This file must be copied to .env and the appropriate variables populated.
22
33
4+ # GitHub
5+
6+ # https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api#primary-rate-limit-for-authenticated-users
7+ #
8+ # https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api
9+
10+ # GH_TOKEN =
11+
12+
413## GCS (Google Custom Search)
514
615# https://developers.google.com/custom-search/v1/introduction
2130
2231# GCS_CX =
2332
33+
2434## Flickr
35+
2536# "The flickr developer guide: https://www.flickr.com/services/developer/"
2637
2738# FLICKR_API_KEY =
Original file line number Diff line number Diff line change 3131
3232# Constants
3333FILE1_COUNT = os .path .join (PATHS ["data_phase" ], "github_1_count.csv" )
34+ GH_TOKEN = os .getenv ("GH_TOKEN" )
3435GITHUB_RETRY_STATUS_FORCELIST = [
3536 408 , # Request Timeout
36- 422 , # Unprocessable Content
37- # (Validation failed, or the endpoint has been spammed)
37+ 422 , # Unprocessable Content (Validation failed, or endpoint spammed)
3838 429 , # Too Many Requests
3939 500 , # Internal Server Error
4040 502 , # Bad Gateway
@@ -94,7 +94,10 @@ def get_requests_session():
9494 )
9595 session = requests .Session ()
9696 session .mount ("https://" , HTTPAdapter (max_retries = max_retries ))
97- session .headers .update ({"Accept" : "application/vnd.github+json" })
97+ headers = {"accept" : "application/vnd.github+json" }
98+ if GH_TOKEN :
99+ headers ["authorization" ] = f"Bearer { GH_TOKEN } "
100+ session .headers .update (headers )
98101
99102 return session
100103
You can’t perform that action at this time.
0 commit comments