Skip to content

Commit

Permalink
Add documentation and test for Client.get_me
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Jan 7, 2022
1 parent c49cbdf commit 62b5b58
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
69 changes: 69 additions & 0 deletions cassettes/test_get_me.yaml
@@ -0,0 +1,69 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- Python/3.10.0 Requests/2.27.1 Tweepy/4.4.0
method: GET
uri: https://api.twitter.com/2/users/me
response:
body:
string: !!binary |
H4sIAAAAAAAAAKpWSkksSVSyqlbKTFGyUjI0MDcyMjUwNTYyMzG1tLQwtTRT0lHKS8xNBUqGlKem
FlQqhKQWl2TmpQPFS4tTi1DkXFLLlGprAQAAAP//AwBsn+W8VAAAAA==
headers:
api-version:
- '2.32'
cache-control:
- no-cache, no-store, max-age=0
content-disposition:
- attachment; filename=json.json
content-encoding:
- gzip
content-length:
- '97'
content-type:
- application/json; charset=utf-8
date:
- Fri, 07 Jan 2022 08:05:56 UTC
server:
- tsa_b
set-cookie:
- guest_id_marketing=v1%3A164154275647329260; Max-Age=63072000; Expires=Sun,
07 Jan 2024 08:05:56 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- guest_id_ads=v1%3A164154275647329260; Max-Age=63072000; Expires=Sun, 07 Jan
2024 08:05:56 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- personalization_id="v1_ihenaUbNvkcvFbDMb0HZ4g=="; Max-Age=63072000; Expires=Sun,
07 Jan 2024 08:05:56 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- guest_id=v1%3A164154275647329260; Max-Age=63072000; Expires=Sun, 07 Jan 2024
08:05:56 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
strict-transport-security:
- max-age=631138519
x-access-level:
- read-write-directmessages
x-connection-hash:
- 387c0d90998be5164939411741317edc2ba8d97f40d6722aeac473c4a50c6d58
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-rate-limit-limit:
- '75'
x-rate-limit-remaining:
- '74'
x-rate-limit-reset:
- '1641543656'
x-response-time:
- '36'
x-xss-protection:
- '0'
status:
code: 200
message: OK
version: 1
5 changes: 5 additions & 0 deletions docs/client.rst
Expand Up @@ -108,6 +108,8 @@
+--------------------------------------------------------------+----------------------------------------+
| `GET /2/users/by`_ | :meth:`Client.get_users` |
+--------------------------------------------------------------+----------------------------------------+
| `GET /2/users/me`_ | :meth:`Client.get_me` |
+--------------------------------------------------------------+----------------------------------------+
| .. centered:: :ref:`Spaces` |
+-------------------------------------------------------------------------------------------------------+
| .. centered:: |Search Spaces|_ |
Expand Down Expand Up @@ -227,6 +229,7 @@
.. _GET /2/users/by/username/:username: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-by-username-username
.. _GET /2/users: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users
.. _GET /2/users/by: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-by
.. _GET /2/users/me: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-me
.. |Search Spaces| replace:: *Search Spaces*
.. _GET /2/spaces/search: https://developer.twitter.com/en/docs/twitter-api/spaces/search/api-reference/get-spaces-search
.. |Spaces lookup| replace:: *Spaces lookup*
Expand Down Expand Up @@ -370,6 +373,8 @@ User lookup

.. automethod:: Client.get_users

.. automethod:: Client.get_me

Spaces
======

Expand Down
4 changes: 4 additions & 0 deletions tests/test_client.py
Expand Up @@ -131,6 +131,10 @@ def test_get_user(self):
def test_get_users(self):
self.client.get_users(usernames=["Twitter", "TwitterDev"])

@tape.use_cassette("test_get_me.yaml", serializer="yaml")
def test_get_me(self):
self.client.get_me(user_auth=True)

@tape.use_cassette("test_search_spaces.yaml", serializer="yaml")
def test_search_spaces(self):
self.client.search_spaces("Twitter")
Expand Down

0 comments on commit 62b5b58

Please sign in to comment.