interpals-api 2.3.1__tar.gz → 3.0__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.
- interpals_api-3.0/PKG-INFO +151 -0
- interpals_api-3.0/README.md +117 -0
- interpals_api-3.0/interpals_api/__init__.py +125 -0
- interpals_api-3.0/interpals_api/api.py +352 -0
- interpals_api-3.0/interpals_api/config.py +15 -0
- interpals_api-3.0/interpals_api/cookie.py +76 -0
- {interpals_api-2.3.1 → interpals_api-3.0}/interpals_api/errors.py +3 -9
- interpals_api-3.0/interpals_api/parsers/pictures.py +57 -0
- interpals_api-3.0/interpals_api/parsers/profile.py +119 -0
- interpals_api-3.0/interpals_api/parsers/userdata.py +32 -0
- interpals_api-3.0/interpals_api/schemas.py +86 -0
- interpals_api-3.0/interpals_api/session.py +166 -0
- interpals_api-3.0/interpals_api/utils.py +63 -0
- interpals_api-3.0/interpals_api.egg-info/PKG-INFO +151 -0
- {interpals_api-2.3.1 → interpals_api-3.0}/interpals_api.egg-info/SOURCES.txt +12 -4
- interpals_api-3.0/interpals_api.egg-info/requires.txt +3 -0
- {interpals_api-2.3.1 → interpals_api-3.0}/interpals_api.egg-info/top_level.txt +1 -0
- {interpals_api-2.3.1 → interpals_api-3.0}/setup.py +5 -6
- interpals_api-3.0/tests/__init__.py +0 -0
- interpals_api-3.0/tests/common.py +50 -0
- interpals_api-3.0/tests/test_async.py +55 -0
- interpals_api-3.0/tests/test_cookie.py +127 -0
- interpals_api-3.0/tests/test_parsers.py +48 -0
- interpals_api-3.0/tests/test_session.py +35 -0
- interpals_api-3.0/tests/test_sync.py +53 -0
- interpals_api-2.3.1/PKG-INFO +0 -192
- interpals_api-2.3.1/README.md +0 -157
- interpals_api-2.3.1/interpals_api/__init__.py +0 -161
- interpals_api-2.3.1/interpals_api/api.py +0 -655
- interpals_api-2.3.1/interpals_api/cookie.py +0 -48
- interpals_api-2.3.1/interpals_api/parsers/chat_parser.py +0 -132
- interpals_api-2.3.1/interpals_api/parsers/friends_parser.py +0 -53
- interpals_api-2.3.1/interpals_api/parsers/pictures_parser.py +0 -91
- interpals_api-2.3.1/interpals_api/parsers/profile_parser.py +0 -124
- interpals_api-2.3.1/interpals_api/session.py +0 -243
- interpals_api-2.3.1/interpals_api/utils.py +0 -23
- interpals_api-2.3.1/interpals_api.egg-info/PKG-INFO +0 -192
- interpals_api-2.3.1/interpals_api.egg-info/requires.txt +0 -4
- {interpals_api-2.3.1 → interpals_api-3.0}/interpals_api/parsers/__init__.py +0 -0
- {interpals_api-2.3.1 → interpals_api-3.0}/interpals_api.egg-info/dependency_links.txt +0 -0
- {interpals_api-2.3.1 → interpals_api-3.0}/interpals_api.egg-info/not-zip-safe +0 -0
- {interpals_api-2.3.1 → interpals_api-3.0}/setup.cfg +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: interpals-api
|
|
3
|
+
Version: 3.0
|
|
4
|
+
Summary: Unofficial Python API for interpals.net.
|
|
5
|
+
Home-page: https://github.com/fomalhaut88/interpals-api
|
|
6
|
+
Author: Alexander Khlebushchev
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://pypi.org/project/interpals-api/
|
|
9
|
+
Project-URL: Documentation, https://fomalhaut88.github.io/interpals-api/
|
|
10
|
+
Project-URL: Source, https://github.com/fomalhaut88/interpals-api
|
|
11
|
+
Project-URL: Issues, https://github.com/fomalhaut88/interpals-api/issues
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: aiohttp>=3.14
|
|
22
|
+
Requires-Dist: requests>=2.34
|
|
23
|
+
Requires-Dist: yarl>=1.25
|
|
24
|
+
Dynamic: author
|
|
25
|
+
Dynamic: classifier
|
|
26
|
+
Dynamic: description
|
|
27
|
+
Dynamic: description-content-type
|
|
28
|
+
Dynamic: home-page
|
|
29
|
+
Dynamic: license
|
|
30
|
+
Dynamic: project-url
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
Dynamic: summary
|
|
34
|
+
|
|
35
|
+
# interpals-api
|
|
36
|
+
|
|
37
|
+
This Python library provides a simple HTTP API for working with the website https://interpals.net/. It includes:
|
|
38
|
+
|
|
39
|
+
* retrieving data by user identifier
|
|
40
|
+
* listing visitors
|
|
41
|
+
* searching for users by criteria
|
|
42
|
+
* viewing users
|
|
43
|
+
* listing albums and pictures
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
pip install interpals-api
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Basic example
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from interpals_api import login_sync, ApiSync
|
|
55
|
+
|
|
56
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
57
|
+
api = ApiSync(session)
|
|
58
|
+
|
|
59
|
+
profile = api.profile('someuser')
|
|
60
|
+
print(profile)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Since version `2.1` it supports asynchronous calls for each api method. Below is a brief asynchronous example:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from interpals_api import login_async, ApiAsync
|
|
67
|
+
|
|
68
|
+
session = await login_async('yourusername', 'yourpassword')
|
|
69
|
+
api = ApiAsync(session)
|
|
70
|
+
|
|
71
|
+
profile = await api.profile('someuser')
|
|
72
|
+
print(profile)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Other examples
|
|
76
|
+
|
|
77
|
+
Basic example to retrieve user info:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from interpals_api import login_sync, ApiSync
|
|
81
|
+
|
|
82
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
83
|
+
api = ApiSync(session)
|
|
84
|
+
|
|
85
|
+
# This gives info of the user with the link: https://www.interpals.net/someuser
|
|
86
|
+
profile = api.profile('someuser')
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Dump and load session object:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from interpals_api import login_sync, ApiSync
|
|
93
|
+
|
|
94
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
95
|
+
|
|
96
|
+
# Save session into a file
|
|
97
|
+
with open('session.txt', 'w') as f:
|
|
98
|
+
f.write(session.dumps())
|
|
99
|
+
|
|
100
|
+
# Load session from the saved file
|
|
101
|
+
with open('session.txt') as f:
|
|
102
|
+
session = Session.loads(f.read())
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Viewing and searching for users:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from interpals_api import login_sync, ApiSync
|
|
109
|
+
from interpals_api.schemas import SearchOptions
|
|
110
|
+
|
|
111
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
112
|
+
api = ApiSync(session)
|
|
113
|
+
|
|
114
|
+
# Viewing a certain user
|
|
115
|
+
api.view('someuser')
|
|
116
|
+
|
|
117
|
+
# Showing the visitors of your profile
|
|
118
|
+
users = api.visitors()
|
|
119
|
+
print(users)
|
|
120
|
+
|
|
121
|
+
# Searching for users
|
|
122
|
+
options = SearchOptions(
|
|
123
|
+
age1=20,
|
|
124
|
+
age2=40,
|
|
125
|
+
sex=['male', 'female'],
|
|
126
|
+
continents=['AF', 'AS', 'EU', 'NA', 'OC', 'SA'],
|
|
127
|
+
countries=['US', 'CA', 'UK', 'RU'],
|
|
128
|
+
keywords='travelling',
|
|
129
|
+
online=True,
|
|
130
|
+
city_name='London' # Or you can use 'city_code' with its direct code on the website (it's faster)
|
|
131
|
+
)
|
|
132
|
+
for user in api.search(options, limit=100, timeout=1.0):
|
|
133
|
+
print(user)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
To work with pictures, it is necessary to use `uid` in methods:
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from interpals_api import login_sync, ApiSync
|
|
140
|
+
|
|
141
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
142
|
+
api = ApiSync(session)
|
|
143
|
+
|
|
144
|
+
uid = api.get_uid('someuser')
|
|
145
|
+
|
|
146
|
+
albums = api.albums(uid)
|
|
147
|
+
for album in albums:
|
|
148
|
+
pictures = api.pictures(uid, album.aid)
|
|
149
|
+
for picture in pictures:
|
|
150
|
+
print(picture.large)
|
|
151
|
+
```
|
|
@@ -0,0 +1,117 @@
|
|
|
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 criteria
|
|
8
|
+
* viewing users
|
|
9
|
+
* listing albums and pictures
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
pip install interpals-api
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Basic example
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from interpals_api import login_sync, ApiSync
|
|
21
|
+
|
|
22
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
23
|
+
api = ApiSync(session)
|
|
24
|
+
|
|
25
|
+
profile = api.profile('someuser')
|
|
26
|
+
print(profile)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Since version `2.1` it supports asynchronous calls for each api method. Below is a brief asynchronous example:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from interpals_api import login_async, ApiAsync
|
|
33
|
+
|
|
34
|
+
session = await login_async('yourusername', 'yourpassword')
|
|
35
|
+
api = ApiAsync(session)
|
|
36
|
+
|
|
37
|
+
profile = await api.profile('someuser')
|
|
38
|
+
print(profile)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Other examples
|
|
42
|
+
|
|
43
|
+
Basic example to retrieve user info:
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from interpals_api import login_sync, ApiSync
|
|
47
|
+
|
|
48
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
49
|
+
api = ApiSync(session)
|
|
50
|
+
|
|
51
|
+
# This gives info of the user with the link: https://www.interpals.net/someuser
|
|
52
|
+
profile = api.profile('someuser')
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Dump and load session object:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from interpals_api import login_sync, ApiSync
|
|
59
|
+
|
|
60
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
61
|
+
|
|
62
|
+
# Save session into a file
|
|
63
|
+
with open('session.txt', 'w') as f:
|
|
64
|
+
f.write(session.dumps())
|
|
65
|
+
|
|
66
|
+
# Load session from the saved file
|
|
67
|
+
with open('session.txt') as f:
|
|
68
|
+
session = Session.loads(f.read())
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Viewing and searching for users:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from interpals_api import login_sync, ApiSync
|
|
75
|
+
from interpals_api.schemas import SearchOptions
|
|
76
|
+
|
|
77
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
78
|
+
api = ApiSync(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 = SearchOptions(
|
|
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
|
+
city_name='London' # Or you can use 'city_code' 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 pictures, it is necessary to use `uid` in methods:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from interpals_api import login_sync, ApiSync
|
|
106
|
+
|
|
107
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
108
|
+
api = ApiSync(session)
|
|
109
|
+
|
|
110
|
+
uid = api.get_uid('someuser')
|
|
111
|
+
|
|
112
|
+
albums = api.albums(uid)
|
|
113
|
+
for album in albums:
|
|
114
|
+
pictures = api.pictures(uid, album.aid)
|
|
115
|
+
for picture in pictures:
|
|
116
|
+
print(picture.large)
|
|
117
|
+
```
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"""
|
|
2
|
+
# interpals-api
|
|
3
|
+
|
|
4
|
+
This Python library provides a simple HTTP API for working with the website
|
|
5
|
+
https://interpals.net/. It includes:
|
|
6
|
+
|
|
7
|
+
* retrieving data by user identifier
|
|
8
|
+
* listing visitors
|
|
9
|
+
* searching for users by criteria
|
|
10
|
+
* viewing users
|
|
11
|
+
* listing albums and pictures
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
pip install interpals-api
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Basic example
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from interpals_api import login_sync, ApiSync
|
|
23
|
+
|
|
24
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
25
|
+
api = ApiSync(session)
|
|
26
|
+
|
|
27
|
+
profile = api.profile('someuser')
|
|
28
|
+
print(profile)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Since version `2.1` it supports asynchronous calls for each api method. Below
|
|
32
|
+
there is a brief asynchronous example:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from interpals_api import login_async, ApiAsync
|
|
36
|
+
|
|
37
|
+
session = await login_async('yourusername', 'yourpassword')
|
|
38
|
+
api = ApiAsync(session)
|
|
39
|
+
|
|
40
|
+
profile = await api.profile('someuser')
|
|
41
|
+
print(profile)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Other examples
|
|
45
|
+
|
|
46
|
+
Basic example to retrieve user info:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from interpals_api import login_sync, ApiSync
|
|
50
|
+
|
|
51
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
52
|
+
api = ApiSync(session)
|
|
53
|
+
|
|
54
|
+
# This gives info of the user with the link: https://www.interpals.net/someuser
|
|
55
|
+
profile = api.profile('someuser')
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Dump and load session object:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from interpals_api import login_sync, ApiSync
|
|
62
|
+
|
|
63
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
64
|
+
|
|
65
|
+
# Save session into a file
|
|
66
|
+
with open('session.txt', 'w') as f:
|
|
67
|
+
f.write(session.dumps())
|
|
68
|
+
|
|
69
|
+
# Load session from the saved file
|
|
70
|
+
with open('session.txt') as f:
|
|
71
|
+
session = Session.loads(f.read())
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Viewing and searching for users:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from interpals_api import login_sync, ApiSync
|
|
78
|
+
from interpals_api.schemas import SearchOptions
|
|
79
|
+
|
|
80
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
81
|
+
api = ApiSync(session)
|
|
82
|
+
|
|
83
|
+
# Viewing a certain user
|
|
84
|
+
api.view('someuser')
|
|
85
|
+
|
|
86
|
+
# Showing the visitors of your profile
|
|
87
|
+
users = api.visitors()
|
|
88
|
+
print(users)
|
|
89
|
+
|
|
90
|
+
# Searching for users
|
|
91
|
+
options = SearchOptions(
|
|
92
|
+
age1=20,
|
|
93
|
+
age2=40,
|
|
94
|
+
sex=['male', 'female'],
|
|
95
|
+
continents=['AF', 'AS', 'EU', 'NA', 'OC', 'SA'],
|
|
96
|
+
countries=['US', 'CA', 'UK', 'RU'],
|
|
97
|
+
keywords='travelling',
|
|
98
|
+
online=True,
|
|
99
|
+
city_name='London' # Or you can use 'city_code' with its direct code on
|
|
100
|
+
# the website (it's faster)
|
|
101
|
+
)
|
|
102
|
+
for user in api.search(options, limit=100, timeout=1.0):
|
|
103
|
+
print(user)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
To work with pictures, it is necessary to use `uid` in methods:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from interpals_api import login_sync, ApiSync
|
|
110
|
+
|
|
111
|
+
session = login_sync('yourusername', 'yourpassword')
|
|
112
|
+
api = ApiSync(session)
|
|
113
|
+
|
|
114
|
+
uid = api.get_uid('someuser')
|
|
115
|
+
|
|
116
|
+
albums = api.albums(uid)
|
|
117
|
+
for album in albums:
|
|
118
|
+
pictures = api.pictures(uid, album.aid)
|
|
119
|
+
for picture in pictures:
|
|
120
|
+
print(picture.large)
|
|
121
|
+
```
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
from .session import Session, login_sync, login_async # noqa: F401
|
|
125
|
+
from .api import ApiSync, ApiAsync # noqa: F401
|