Skip to main content

To decode the Bencode string to Python native datatypes

Project description

Bencoder Decoder Library

A python library to decode the Bencode String to native Python data types i.e int,str,list and dictionary.

How to use: There are two ways to use this Library.

a) Clone GitHub Repo:

  • Clone the github repo https://github.com/malhotraguy/klik_interview
  from bencode.bencode_decoder import decoder
  bencode_data = "8:robots54"
  decoded_value = decoder(bencode_data=bencode_data)
  print(decoded_value)
  # robots54
  bencode_data = "l5:green3:red4:bluee"
  decoded_value = decoder(bencode_data=bencode_data)
  print(decoded_value)
  # ["green", "red", "blue"]
  • For more examples refer to tests folder.

b) Install as python library:

  • Install the library: pip install klik-bencode==0.1
 from bencode.bencode_decoder import decoder
 bencode_data = "8:robots54"
 decoded_value = decoder(bencode_data=bencode_data)
 print(decoded_value)
 # robots54
 bencode_data = "l5:green3:red4:bluee"
 decoded_value = decoder(bencode_data=bencode_data)
 print(decoded_value)
 # ["green", "red", "blue"]

Project details


Release history Release notifications

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for klik-bencode, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size klik_bencode-0.1-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size klik-bencode-0.1.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page