You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-6Lines changed: 35 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,27 +55,56 @@ You can now use the SDK.
55
55
56
56
## Getting Started
57
57
58
+
For use the client you need set basic variables for that you have two option setup environment variables (using a
59
+
.env file or set in your OS) or create a config.json.
60
+
58
61
### Setting up environment variables
59
62
60
-
To configure the client using environment variables, you must create a **.env** file using [.env.example](https://github.com/pinterest/pinterest-python-sdk/blob/main/.env.example)
63
+
To configure the client using environment variables, you must create a **.env** file using [.env.example](./pinterest/.env.example)
61
64
as a template. For basic configuration and usage you need to set the following environment variables in the **.env** file:
62
65
63
-
```
64
-
PINTEREST_ACCESS_TOKEN='<access token>'
65
-
```
66
-
_or_
67
66
```
68
67
PINTEREST_APP_ID=<app id>
69
68
PINTEREST_APP_SECRET=<app secret>
69
+
70
70
PINTEREST_REFRESH_ACCESS_TOKEN='<refresh token>'
71
+
**or**
72
+
PINTEREST_ACCESS_TOKEN='<access token>'
71
73
```
72
74
73
-
Once you have established the environment variables, the client will be instantiated for you automatically.
75
+
Once you have established the environment variables, the client will be instantiated for you automatically.
74
76
75
77
**NOTE**:
76
78
* Setting the `PINTEREST_ACCESS_TOKEN` (which is valid for thirty days) will require the token value to be replaced when it expires. You will need to manually reinsantiate the client when the **access_token** expires.
77
79
* Setting the `PINTEREST_REFRESH_ACCESS_TOKEN` (which is valid for a year) will allow the SDK to regenerate the new access token whenever it is required.
78
80
81
+
### Setting up config.json
82
+
83
+
To configure the client using config.json, you must create a **config.json** file using [config.json.example](./pinterest/config.json.example)
84
+
as a template. For basic configuration and usage you need to set the following key in the **config.json** file:
85
+
86
+
```json
87
+
{
88
+
"app_id": "<app id>",
89
+
"app_secret": "<app secret>",
90
+
"refresh_access_token": "<refresh token>"
91
+
}
92
+
```
93
+
94
+
**or**
95
+
96
+
```json
97
+
{
98
+
"access_token": "<access token>"
99
+
}
100
+
```
101
+
102
+
Once you have established the keys, the client will be instantiated for you automatically.
103
+
104
+
**NOTE**:
105
+
* Setting the `access_token` (which is valid for thirty days) will require the token value to be replaced when it expires. You will need to manually reinsantiate the client when the **access_token** expires.
106
+
* Setting the `refresh_access_token` (which is valid for a year) will allow the SDK to regenerate the new access token whenever it is required.
107
+
79
108
For more information visit the [Authentication](https://developers.pinterest.com/docs/getting-started/authentication/#Refreshing%20an%20access%20token) page.
0 commit comments