Skip to content

Commit

Permalink
Merge branch 'adw0rd:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rickturner2001 authored Aug 13, 2023
2 parents df8553c + 28b2300 commit adbb2be
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 23 deletions.
59 changes: 40 additions & 19 deletions docs/usage-guide/notes.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,53 @@
# Notes *WIP*

| Method | Return | Description
| ----------------------------------------------------------------------- | --------------- | ----------------------------------
| get_my_notes() | dict | get your current notes
| send_note(note_content: str, audience: int = 0) | None | Post a note
| delete_note(note_id: int, audience: int = 0) | dict (status ok) | Delete a note
| Method | Return | Description |
| --------------------------- | ----------------- | ------------------------------- |
| get_notes() | List[Note] | Retrieve direct Notes |
| create_note(text: str, audience: int = 0) | Note | Post a new Note |
| delete_note(note_id: int) | bool | Delete a posted Note |
| update_last_seen_note() | bool | Update the last seen time |

Example:

``` python
>>> cl.get_my_notes()

>>> cl.delete_note(17887679456798301)

>>> cl.send_note("Hello from Instagrapi, everyone can see it !",0)
>>> cl.send_note("Hello from Instagrapi, only close friends can see it !",1)

>>> note = cl.create_note("Hello from Instagrapi, everyone can see it!", 0)
>>> print(note.dict())
{'id': '17849203563031468',
'text': 'Hello from Instagrapi, everyone can see it!',
'user_id': 12312312312,
'user': {
'pk': '12312312312',
'username': 'something',
'full_name': 'merimi on top',
'profile_pic_url': HttpUrl('https://scontent-dus1-1.cdninstagram.com/v/t51.2885-19/364347953_6289474204435297_7603222331512295081_n.jpg?stp=dst-jpg_s150x150&_nc_ht=scontent-dus1-1.cdninstagram.com&_nc_cat=101&_nc_ohc=DVaE0MQwn0YAX8-S8dm&edm=AE-H4JwBAAAA&ccb=7-5&oh=00_AfAnH4mHGMl7B5tqzU7b9PMz9qSC4QE_-EX067lwPHnN1w&oe=64DDA1CB&_nc_sid=cff473', ),
'profile_pic_url_hd': None,
'is_private': False,
'stories': []},
'audience': 0,
'created_at': datetime.datetime(2023, 8, 13, 14, 33, 43, tzinfo=datetime.timezone.utc),
'expires_at': datetime.datetime(2023, 8, 14, 14, 33, 43, tzinfo=datetime.timezone.utc),
'is_emoji_only': False,
'has_translation': False,
'note_style': 0}
>>> notes = cl.get_notes()
>>> print(notes)
[Note(id='17849203563031468', text='Hello from Instagrapi, everyone can see it!', ..., has_translation=False, note_style=0), Note(id='17902958207826742', text='Am so happy 💃💃💃💃🙈🤭', ..., has_translation=False, note_style=0)]

>>> cl.last_seen_update_note()

>>> cl.delete_note(note.id)
```

## Get notes | Send notes | Delete notes
Get your personal notes
Send a note visible to others in the DM page
delete your notes
## Get Notes | Post Notes | Delete Notes
- *Get Notes from Direct*
- *Publish a new note with the ability to select an audience*
- *Delete posted Notes*
- *Update last seen of Notes*

The note should not exceed 60 characters. The rate in between Notes requests should be fairly high *(*i.e : 1 request/ 2 min)* to avoid triggering Instagram API

Common arguments:

* `note_id` - get it from the get_my_notes()
* `note_content` - Content of the note
* `audience` - Who can see the note **(0 = Everyone, 1 = Close Friends only)**
* `note_id` - ID of the Note object
* `text` - Content of the Note
* `audience` - Who can see the note **(0 = Followers you follow back, 1 = Close Friends only)**
6 changes: 3 additions & 3 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
flake8==6.0.0
flake8==6.1.0
Pillow==10.0.0
isort==5.12.0
bandit==1.7.5
mike==1.1.2
markdown-include==0.8.1
mkdocs-material==9.1.19
mkdocs-minify-plugin==0.6.4
mkdocs-material==9.1.21
mkdocs-minify-plugin==0.7.1
mkdocstrings==0.22.0
./util/mkdocs-redirects
./util/mkdocstrings_patch_type_aliases
2 changes: 1 addition & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def test_age_restricted_user_info_by_username(self):
self.assertFalse(user.is_private)

def test_send_new_note(self):
self._cl.send_note("Hello from Instagrapi !", 0)
self._cl.create_note("Hello from Instagrapi !", 0)


class ClientMediaTestCase(ClientPrivateTestCase):
Expand Down

0 comments on commit adbb2be

Please sign in to comment.