Skip to content

Commit ada7416

Browse files
authored
Merge pull request #226 from shunyooo/master
Update README.md: Set the current_user
2 parents 5841154 + 90ceb41 commit ada7416

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,24 @@ page.locked = True
226226
page.locked = False
227227
```
228228

229+
## Example: Set the current user for multi-account user
230+
231+
```python
232+
from notion.client import NotionClient
233+
client = NotionClient(token_v2="<token_v2>")
234+
235+
# The initial current_user of a multi-account user may be an unwanted user
236+
print(client.current_user.email) # → not_the_desired@email.co.jp
237+
238+
# Set current_user to the desired user
239+
client.set_user_by_email('desired@email.com')
240+
print(client.current_user.email) # → desired@email.com
241+
242+
# You can also set the current_user by uid.
243+
client.set_user_by_uid('<uid>')
244+
print(client.current_user.email) # → desired@email.com
245+
```
246+
229247
# _Quick plug: Learning Equality needs your support!_
230248

231249
If you'd like to support notion-py development, please consider [donating to my open-source nonprofit, Learning Equality](https://learningequality.org/donate/), since when I'm not working on notion-py, it probably means I'm heads-down fundraising for our global education work (bringing resources like Khan Academy to communities with no Internet). COVID has further amplified needs, with over a billion kids stuck at home, and over half of them without the connectivity they need for distance learning. You can now also [support our work via GitHub Sponsors](https://github.com/sponsors/learningequality)!
@@ -234,6 +252,7 @@ If you'd like to support notion-py development, please consider [donating to my
234252

235253
- [md2notion](https://github.com/Cobertos/md2notion): import Markdown files to Notion
236254
- [notion-export-ics](https://github.com/evertheylen/notion-export-ics): Export Notion Databases to ICS calendar files
255+
- [notion-tqdm](https://github.com/shunyooo/notion-tqdm): Progress Bar displayed in Notion like tqdm
237256

238257
# TODO
239258

0 commit comments

Comments
 (0)