Skip to main content

interpals-api

This Python library provides a simple HTTP API for working with the website https://interpals.net/. It includes:

  • retrieving data by user identifier
  • listing visitors
  • searching for users by criterions
  • viewing and sending messages, deleting chats
  • listing, adding and removing friends
  • listing albums and pictures

Installation

pip install interpals-api

Basic example

from interpals_api import Session, Api

session = Session.login('yourusername', 'yourpassword')
api = Api(session)

user_info = api.profile('someuser')
print(user_info)

Since version 2.1 it supports asynchronous calls for each api method. Below there is a brief asynchonous example:

from interpals_api import SessionAsync, ApiAsync

session = await SessionAsync.login('yourusername', 'yourpassword')
api = ApiAsync(session)

user_info = await api.profile('someuser')
print(user_info)

Other examples

Basic example to retrieve user info:

from interpals_api import Session, Api

session = Session.login('yourusername', 'yourpassword')
api = Api(session)

# This gives info of the user with the link: https://www.interpals.net/someuser
user_info = api.profile('someuser')

Dump and load session object:

from interpals_api import Session, Api

session = Session.login('yourusername', 'yourpassword')

# Save session into a file
with open('session.json', 'w') as f:
    session.dump(f)

# Load session from the saved file
with open('session.json') as f:
    session = Session.load(f)

Viewing and searching for users:

from interpals_api import Session, Api

session = Session.login('yourusername', 'yourpassword')
api = Api(session)

# Viewing a certain user
api.view('someuser')

# Showing the visitors of your profile
users = api.visitors()
print(users)

# Searching for users
options = {
    'age1': '20',
    'age2': '40',
    'sex': ['male', 'female'],
    'continents': ['AF', 'AS', 'EU', 'NA', 'OC', 'SA'],
    'countries': ['US', 'CA', 'UK', 'RU'],
    'keywords': 'travelling',
    'online': True,
    'cityName': 'London'  # Or you can use 'city' with its direct code on the website (it's faster)
}
for user in api.search(options, limit=100, timeout=1.0):
    print(user)

To work with friends and pictures, it is necessary to use uid in methods:

from interpals_api import Session, Api

session = Session.login('yourusername', 'yourpassword')
api = Api(session)

uid = api.get_uid('someuser')

# Listing friends of the user 'someuser'
friends = api.friends(uid)
print(friends)

# Adding 'someuser' to friends
api.friend_add(uid)

# Removing 'someuser' from friends
api.friend_remove(uid)

# Listing pictures
albums = api.albums(uid)
for album in albums:
    aid = album['aid']
    pictures = api.pictures(uid, aid)
    for picture in pictures:
        print(picture['src'])

Working with the chat is done through thread_id:

from interpals_api import Session, Api

session = Session.login('yourusername', 'yourpassword')
api = Api(session)

uid = api.get_uid('someuser')

# Listing your chats
result = api.chat(count=9, offset=0)
print(result['chats'])

# Staring new chat (getting thread_id)
thread_id = api.get_thread_id(uid)

# Show chat messages
messages = api.chat_messages(thread_id)
print(messages)

# Send new message to the thread
api.chat_send(thread_id, "Hey! How are you?")

# Removing chat
api.chat_delete(thread_id)

Metadata

Release files for interpals-api 2.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for interpals-api 2.3.1
File Size Uploaded Provenance
interpals_api-2.3.1.tar.gz 13.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for interpals-api 2.3.1
File Interpreter ABI Platform
interpals_api-2.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.1 kB

Release files / interpals_api-2.3.1.tar.gz

Download URL interpals_api-2.3.1.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
81efe569675c792d2d50a0b86dc6d8febd80104a0a50f90d2b2df587fd6de0ac
BLAKE2b-256 checksum
How to use checksums
df0843e5fba9264d9fe3275c21f13c3619fcfa71dcb3f235919f2fd1878294a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / interpals_api-2.3.1-py3-none-any.whl

Download URL interpals_api-2.3.1-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e632018880aa005c5a069fb64de990ca9b2936197917c531f4115b7db0e9193
BLAKE2b-256 checksum
How to use checksums
6c009ec5b0f51ab39c0b850ef4b4a54b68d7aafbe9e11a9379215af940849986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for interpals-api 2.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page