Finding the shortest path from one vk user to another through friends.
Project description
Vk Connections: the shortest path from one vk user to another
Library that finds the shortest path from one vk user to another through friends.
VkConnection classes
class Create(keys)
Parametrs:
- keys - list of 4 Vk api keys (user or community access)
Note that keys is a list with exactly 4 api keys, this requires fast work of library (each request being processed under 30 sec)
Methods of Create class
getConnection(userFrom, userTo)
Parameters:
- userFrom – id/nickname/link to user A
- userTo – id/nickname/link to user B
Result: A list of lists of dictionaries {id: person_id, full_name: person_full_name, photo: person_photo}
printResult(result)
- prints the result from main method
Installation
pip install vkconnections
Example
import vkconnections
# Vk API Keys
firstKey = 'XXX'
secondKey = 'XXX'
thirdKey = 'XXX'
fourthKey = 'XXX'
keys = [firstKey, secondKey, thirdKey, fourthKey] # all the keys in one list
vk = vkconnections.Create(keys) # creating an instance of a class
# users for making a way
userFrom = "alsu"
userTo = "dm"
result = vk.getConnection(userFrom, userTo) # receiving a result
vk.printConnection(result) # printing result
Output:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vkconnections-0.0.3.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for vkconnections-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 387d19ffd7b78e412ad815e7886598d045b35a35258d6748e690cb960c8d6e6f |
|
MD5 | 2b1e31457c4d48477b1d0e1d7cae98bd |
|
BLAKE2b-256 | 0ce5aa1e9c767fc64ff147fc14a64849ea183f5b1f3282c0915c290a803b53e3 |