interpals-api 2.1.0__tar.gz → 2.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. interpals-api-2.2.1/PKG-INFO +167 -0
  2. {interpals-api-2.1.0 → interpals-api-2.2.1}/README.md +157 -157
  3. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/__init__.py +2 -2
  4. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/api.py +504 -503
  5. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/cookie.py +38 -38
  6. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/errors.py +34 -34
  7. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/parsers/chat_parser.py +98 -98
  8. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/parsers/friends_parser.py +34 -34
  9. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/parsers/pictures_parser.py +62 -62
  10. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/parsers/profile_parser.py +105 -105
  11. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/request.py +43 -43
  12. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/session.py +197 -197
  13. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/utils.py +12 -12
  14. interpals-api-2.2.1/interpals_api.egg-info/PKG-INFO +167 -0
  15. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api.egg-info/not-zip-safe +1 -1
  16. {interpals-api-2.1.0 → interpals-api-2.2.1}/setup.cfg +4 -4
  17. {interpals-api-2.1.0 → interpals-api-2.2.1}/setup.py +26 -26
  18. interpals-api-2.1.0/PKG-INFO +0 -169
  19. interpals-api-2.1.0/interpals_api.egg-info/PKG-INFO +0 -169
  20. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api/parsers/__init__.py +0 -0
  21. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api.egg-info/SOURCES.txt +0 -0
  22. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api.egg-info/dependency_links.txt +0 -0
  23. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api.egg-info/requires.txt +0 -0
  24. {interpals-api-2.1.0 → interpals-api-2.2.1}/interpals_api.egg-info/top_level.txt +0 -0
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.1
2
+ Name: interpals-api
3
+ Version: 2.2.1
4
+ Summary: UNKNOWN
5
+ Home-page: UNKNOWN
6
+ Author: Alexander Khlebushchev
7
+ License: MIT
8
+ Description: # interpals-api
9
+
10
+ This Python library provides a simple HTTP API for working with the website https://interpals.net/. It includes:
11
+
12
+ * retrieving data by user identifier
13
+ * listing visitors
14
+ * searching for users by criterions
15
+ * viewing and sending messages, deleting chats
16
+ * listing, adding and removing friends
17
+ * listing albums and pictures
18
+
19
+ ## Installation
20
+
21
+ ```
22
+ pip install interpals-api
23
+ ```
24
+
25
+ ## Basic example
26
+
27
+ ```python
28
+ from interpals_api import Session, Api
29
+
30
+ session = Session.login('yourusername', 'yourpassword')
31
+ api = Api(session)
32
+
33
+ user_info = api.profile('someuser')
34
+ print(user_info)
35
+ ```
36
+
37
+ Since version `2.1` it supports asynchronous calls for each api method. Below there is a brief asynchonous example:
38
+
39
+ ```python
40
+ from interpals_api import SessionAsync, ApiAsync
41
+
42
+ session = await SessionAsync.login('yourusername', 'yourpassword')
43
+ api = ApiAsync(session)
44
+
45
+ user_info = await api.profile('someuser')
46
+ print(user_info)
47
+ ```
48
+
49
+ ## Other examples
50
+
51
+ Basic example to retrieve user info:
52
+
53
+ ```python
54
+ from interpals_api import Session, Api
55
+
56
+ session = Session.login('yourusername', 'yourpassword')
57
+ api = Api(session)
58
+
59
+ # This gives info of the user with the link: https://www.interpals.net/someuser
60
+ user_info = api.profile('someuser')
61
+ ```
62
+
63
+ Dump and load session object:
64
+
65
+ ```python
66
+ from interpals_api import Session, Api
67
+
68
+ session = Session.login('yourusername', 'yourpassword')
69
+
70
+ # Save session into a file
71
+ with open('session.json', 'w') as f:
72
+ session.dump(f)
73
+
74
+ # Load session from the saved file
75
+ with open('session.json') as f:
76
+ session = Session.load(f)
77
+ ```
78
+
79
+ Viewing and searching for users:
80
+
81
+ ```python
82
+ from interpals_api import Session, Api
83
+
84
+ session = Session.login('yourusername', 'yourpassword')
85
+ api = Api(session)
86
+
87
+ # Viewing a certain user
88
+ api.view('someuser')
89
+
90
+ # Showing the visitors of your profile
91
+ users = api.visitors()
92
+ print(users)
93
+
94
+ # Searching for users
95
+ options = {
96
+ 'age1': '20',
97
+ 'age2': '40',
98
+ 'sex': ['male', 'female'],
99
+ 'continents': ['AF', 'AS', 'EU', 'NA', 'OC', 'SA'],
100
+ 'countries': ['US', 'CA', 'UK', 'RU'],
101
+ 'keywords': 'travelling',
102
+ 'online': True,
103
+ 'cityName': 'London' # Or you can use 'city' with its direct code on the website (it's faster)
104
+ }
105
+ for user in api.search(options, limit=100, timeout=1.0):
106
+ print(user)
107
+ ```
108
+
109
+ To work with friends and pictures, it is necessary to use `uid` in methods:
110
+
111
+ ```python
112
+ from interpals_api import Session, Api
113
+
114
+ session = Session.login('yourusername', 'yourpassword')
115
+ api = Api(session)
116
+
117
+ uid = api.get_uid('someuser')
118
+
119
+ # Listing friends of the user 'someuser'
120
+ friends = api.friends(uid)
121
+ print(friends)
122
+
123
+ # Adding 'someuser' to friends
124
+ api.friend_add(uid)
125
+
126
+ # Removing 'someuser' from friends
127
+ api.friend_remove(uid)
128
+
129
+ # Listing pictures
130
+ albums = api.albums(uid)
131
+ for album in albums:
132
+ aid = album['aid']
133
+ pictures = api.pictures(uid, aid)
134
+ for picture in pictures:
135
+ print(picture['src'])
136
+ ```
137
+
138
+ Working with the chat is done through `thread_id`:
139
+
140
+ ```python
141
+ from interpals_api import Session, Api
142
+
143
+ session = Session.login('yourusername', 'yourpassword')
144
+ api = Api(session)
145
+
146
+ uid = api.get_uid('someuser')
147
+
148
+ # Listing your chats
149
+ result = api.chat(count=9, offset=0)
150
+ print(result['chats'])
151
+
152
+ # Staring new chat (getting thread_id)
153
+ thread_id = api.get_thread_id(uid)
154
+
155
+ # Show chat messages
156
+ messages = api.chat_messages(thread_id)
157
+ print(messages)
158
+
159
+ # Send new message to the thread
160
+ api.chat_send(thread_id, "Hey! How are you?")
161
+
162
+ # Removing chat
163
+ api.chat_delete(thread_id)
164
+ ```
165
+
166
+ Platform: UNKNOWN
167
+ Description-Content-Type: text/markdown
@@ -1,157 +1,157 @@
1
- # interpals-api
2
-
3
- This Python library provides a simple HTTP API for working with the website https://interpals.net/. It includes:
4
-
5
- * retrieving data by user identifier
6
- * listing visitors
7
- * searching for users by criterions
8
- * viewing and sending messages, deleting chats
9
- * listing, adding and removing friends
10
- * listing albums and pictures
11
-
12
- Basic example:
13
-
14
- ```python
15
- from interpals_api import Session, Api
16
-
17
- session = Session.login('yourusername', 'yourpassword')
18
- api = Api(session)
19
-
20
- user_info = api.profile('someuser')
21
- print(user_info)
22
- ```
23
-
24
- Since version `2.1` it supports asynchronous calls for each api method. Below there is a brief asynchonous example:
25
-
26
- ```python
27
- from interpals_api import SessionAsync, ApiAsync
28
-
29
- session = await SessionAsync.login('yourusername', 'yourpassword')
30
- api = ApiAsync(session)
31
-
32
- user_info = await api.profile('someuser')
33
- print(user_info)
34
- ```
35
-
36
- ## Installation
37
-
38
- ```
39
- pip install interpals-api
40
- ```
41
-
42
- ## Examples
43
-
44
- Basic example to retrieve user info:
45
-
46
- ```python
47
- from interpals_api import Session, Api
48
-
49
- session = Session.login('yourusername', 'yourpassword')
50
- api = Api(session)
51
-
52
- # This gives info of the user with the link: https://www.interpals.net/someuser
53
- user_info = api.profile('someuser')
54
- ```
55
-
56
- Dump and load session object:
57
-
58
- ```python
59
- from interpals_api import Session, Api
60
-
61
- session = Session.login('yourusername', 'yourpassword')
62
-
63
- # Save session into a file
64
- with open('session.json', 'w') as f:
65
- session.dump(f)
66
-
67
- # Load session from the saved file
68
- with open('session.json') as f:
69
- session = Session.load(f)
70
- ```
71
-
72
- Viewing and searching for users:
73
-
74
- ```python
75
- from interpals_api import Session, Api
76
-
77
- session = Session.login('yourusername', 'yourpassword')
78
- api = Api(session)
79
-
80
- # Viewing a certain user
81
- api.view('someuser')
82
-
83
- # Showing the visitors of your profile
84
- users = api.visitors()
85
- print(users)
86
-
87
- # Searching for users
88
- options = {
89
- 'age1': '20',
90
- 'age2': '40',
91
- 'sex': ['male', 'female'],
92
- 'continents': ['AF', 'AS', 'EU', 'NA', 'OC', 'SA'],
93
- 'countries': ['US', 'CA', 'UK', 'RU'],
94
- 'keywords': 'travelling',
95
- 'online': True,
96
- 'cityName': 'London' # Or you can use 'city' with its direct code on the website (it's faster)
97
- }
98
- for user in api.search(options, limit=100, timeout=1.0):
99
- print(user)
100
- ```
101
-
102
- To work with friends and pictures, it is necessary to use `uid` in methods:
103
-
104
- ```python
105
- from interpals_api import Session, Api
106
-
107
- session = Session.login('yourusername', 'yourpassword')
108
- api = Api(session)
109
-
110
- uid = api.get_uid('someuser')
111
-
112
- # Listing friends of the user 'someuser'
113
- friends = api.friends(uid)
114
- print(friends)
115
-
116
- # Adding 'someuser' to friends
117
- api.friend_add(uid)
118
-
119
- # Removing 'someuser' from friends
120
- api.friend_remove(uid)
121
-
122
- # Listing pictures
123
- albums = api.albums(uid)
124
- for album in albums:
125
- aid = album['aid']
126
- pictures = api.pictures(uid, aid)
127
- for picture in pictures:
128
- print(picture['src'])
129
- ```
130
-
131
- Working with the chat is done through `thread_id`:
132
-
133
- ```python
134
- from interpals_api import Session, Api
135
-
136
- session = Session.login('yourusername', 'yourpassword')
137
- api = Api(session)
138
-
139
- uid = api.get_uid('someuser')
140
-
141
- # Listing your chats
142
- result = api.chat(count=9, offset=0)
143
- print(result['chats'])
144
-
145
- # Staring new chat (getting thread_id)
146
- thread_id = api.get_thread_id(uid)
147
-
148
- # Show chat messages
149
- messages = api.chat_messages(thread_id)
150
- print(messages)
151
-
152
- # Send new message to the thread
153
- api.chat_send(thread_id, "Hey! How are you?")
154
-
155
- # Removing chat
156
- api.chat_delete(thread_id)
157
- ```
1
+ # interpals-api
2
+
3
+ This Python library provides a simple HTTP API for working with the website https://interpals.net/. It includes:
4
+
5
+ * retrieving data by user identifier
6
+ * listing visitors
7
+ * searching for users by criterions
8
+ * viewing and sending messages, deleting chats
9
+ * listing, adding and removing friends
10
+ * listing albums and pictures
11
+
12
+ ## Installation
13
+
14
+ ```
15
+ pip install interpals-api
16
+ ```
17
+
18
+ ## Basic example
19
+
20
+ ```python
21
+ from interpals_api import Session, Api
22
+
23
+ session = Session.login('yourusername', 'yourpassword')
24
+ api = Api(session)
25
+
26
+ user_info = api.profile('someuser')
27
+ print(user_info)
28
+ ```
29
+
30
+ Since version `2.1` it supports asynchronous calls for each api method. Below there is a brief asynchonous example:
31
+
32
+ ```python
33
+ from interpals_api import SessionAsync, ApiAsync
34
+
35
+ session = await SessionAsync.login('yourusername', 'yourpassword')
36
+ api = ApiAsync(session)
37
+
38
+ user_info = await api.profile('someuser')
39
+ print(user_info)
40
+ ```
41
+
42
+ ## Other examples
43
+
44
+ Basic example to retrieve user info:
45
+
46
+ ```python
47
+ from interpals_api import Session, Api
48
+
49
+ session = Session.login('yourusername', 'yourpassword')
50
+ api = Api(session)
51
+
52
+ # This gives info of the user with the link: https://www.interpals.net/someuser
53
+ user_info = api.profile('someuser')
54
+ ```
55
+
56
+ Dump and load session object:
57
+
58
+ ```python
59
+ from interpals_api import Session, Api
60
+
61
+ session = Session.login('yourusername', 'yourpassword')
62
+
63
+ # Save session into a file
64
+ with open('session.json', 'w') as f:
65
+ session.dump(f)
66
+
67
+ # Load session from the saved file
68
+ with open('session.json') as f:
69
+ session = Session.load(f)
70
+ ```
71
+
72
+ Viewing and searching for users:
73
+
74
+ ```python
75
+ from interpals_api import Session, Api
76
+
77
+ session = Session.login('yourusername', 'yourpassword')
78
+ api = Api(session)
79
+
80
+ # Viewing a certain user
81
+ api.view('someuser')
82
+
83
+ # Showing the visitors of your profile
84
+ users = api.visitors()
85
+ print(users)
86
+
87
+ # Searching for users
88
+ options = {
89
+ 'age1': '20',
90
+ 'age2': '40',
91
+ 'sex': ['male', 'female'],
92
+ 'continents': ['AF', 'AS', 'EU', 'NA', 'OC', 'SA'],
93
+ 'countries': ['US', 'CA', 'UK', 'RU'],
94
+ 'keywords': 'travelling',
95
+ 'online': True,
96
+ 'cityName': 'London' # Or you can use 'city' with its direct code on the website (it's faster)
97
+ }
98
+ for user in api.search(options, limit=100, timeout=1.0):
99
+ print(user)
100
+ ```
101
+
102
+ To work with friends and pictures, it is necessary to use `uid` in methods:
103
+
104
+ ```python
105
+ from interpals_api import Session, Api
106
+
107
+ session = Session.login('yourusername', 'yourpassword')
108
+ api = Api(session)
109
+
110
+ uid = api.get_uid('someuser')
111
+
112
+ # Listing friends of the user 'someuser'
113
+ friends = api.friends(uid)
114
+ print(friends)
115
+
116
+ # Adding 'someuser' to friends
117
+ api.friend_add(uid)
118
+
119
+ # Removing 'someuser' from friends
120
+ api.friend_remove(uid)
121
+
122
+ # Listing pictures
123
+ albums = api.albums(uid)
124
+ for album in albums:
125
+ aid = album['aid']
126
+ pictures = api.pictures(uid, aid)
127
+ for picture in pictures:
128
+ print(picture['src'])
129
+ ```
130
+
131
+ Working with the chat is done through `thread_id`:
132
+
133
+ ```python
134
+ from interpals_api import Session, Api
135
+
136
+ session = Session.login('yourusername', 'yourpassword')
137
+ api = Api(session)
138
+
139
+ uid = api.get_uid('someuser')
140
+
141
+ # Listing your chats
142
+ result = api.chat(count=9, offset=0)
143
+ print(result['chats'])
144
+
145
+ # Staring new chat (getting thread_id)
146
+ thread_id = api.get_thread_id(uid)
147
+
148
+ # Show chat messages
149
+ messages = api.chat_messages(thread_id)
150
+ print(messages)
151
+
152
+ # Send new message to the thread
153
+ api.chat_send(thread_id, "Hey! How are you?")
154
+
155
+ # Removing chat
156
+ api.chat_delete(thread_id)
157
+ ```
@@ -1,2 +1,2 @@
1
- from .session import Session, SessionAsync
2
- from .api import Api, ApiAsync
1
+ from .session import Session, SessionAsync
2
+ from .api import Api, ApiAsync