gallexis / pytorrent Goto Github PK
View Code? Open in Web Editor NEWSimple BitTorrent client made in Python - Use for learning
License: The Unlicense
Simple BitTorrent client made in Python - Use for learning
License: The Unlicense
Does the project support NAT? I have tried seeding, but I found the message with correct IP but without correct PORT(always 8000) from tracker
So is it possible to create torrent tracker server with this?
connects to some peers but doesn't start the download, it just stays at 'INFO:root:No unchocked peers'
i'm using windows 10 and python 3.9.0
There can be a case where the list of peers in the response from the tracker can be of bytes form instead of dictionary.
s = SockAddr(p['ip'], p['port'])
in the tracker.py will produce [TypeError.)
I am trying to download a file that is shared with the private tracker, but it seems not working. Is it possible to download such files using this library?
Can you add a feature to download from magnet links?
After putting the torrent file like below,
self.torrent = torrent.Torrent().load_from_path(
"ubuntu-18.04.4-desktop-amd64.iso.torrent")
I only get the INFO:root:No unchocked peers in the terminal.
No download is happening.
Thanks.
Hi! Amazing work there. I want to extend your work for seeding. Any ideas which libraries to use?
do you intend to create a kodi addon using pytorrent? would be good for xbox one
elementum is no longer developed and the binary does not run on xbox one, so pytorrent can revolutionize kodi.
Could you put magnet links to download? I want to implement it on Kodi to run on Xbox without depending on binary
I also wanted the python code to pull the specific chunk when the person scrolls through the video on Kodi
I will be happy if I can help with this idea
Does this library support the Bittorrent V2/BEP 52 protocol? If not, I would like to make this a feature request.
I may dive into the library and help submit PRs if this is something that is deemed worth supporting.
DEBUG:root:[['http://openbittorrent.com:80/announce']]
DEBUG:root:[{'path': 'README.txt', 'length': 64}]
INFO:root:PeersManager Started
INFO:root:PiecesManager Started
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): openbittorrent.com:80
DEBUG:urllib3.connectionpool:http://openbittorrent.com:80 "GET /announce?info_hash=0b%87%7B%B5%DA%C7%F4%8A%0E%A7%C4%14%8FV%5Cd%86j%C7&peer_id=%A95%C3%CE%03%A0%C8Q%D6%83%D5S%60%89O%DB%BC%96%EF%06&uploaded=0&downloaded=0&port=6881&left=64&event=started HTTP/1.1" 301 185
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): tracker.openbittorrent.com:80
DEBUG:urllib3.connectionpool:http://tracker.openbittorrent.com:80 "GET /announce?info_hash=0b%87%7B%B5%DA%C7%F4%8A%0E%A7%C4%14%8FV%5Cd%86j%C7&peer_id=%A95%C3%CE%03%A0%C8Q%D6%83%D5S%60%89O%DB%BC%96%EF%06&uploaded=0&downloaded=0&port=6881&left=64&event=started HTTP/1.1" 200 105
DEBUG: {'complete': 1, 'downloaded': 0, 'incomplete': 1, 'interval': 1752, 'min interval': 876, 'peers': b'\xb4\x94i\xd1\x1a\xe1\xb4\x94i\xd1\xc8\xd5'}
ERROR:root:HTTP scraping failed: 'int' object is not subscriptable
Traceback (most recent call last):
File "C:\Users\Jimmy\Documents\pytorrent-master\tracker.py", line 95, in http_scraper
s = SockAddr(p['ip'], p['port'])
TypeError: 'int' object is not subscriptable
hello, I use my own torrent file to test the code, but something wrong like this:
File "F:\研究生\分布式系统\pytorrent-master\pytorrent-master\peers_manager.py", line 96, in run
read_list, _, _ = select.select(read, [], [], 1)
OSError: [WinError 10022] 提供了一个无效的参数(valid argument has provided, in English)。
I guess my own file may cause this error.
Id love to learn how to use your repository but i cant seem to find a documentation for it. can you provide some usage instructions? that would be great
Would i be fine with importing Run() from init and then running. This was just meant for cli, but it would be useful as it's own package.
Exemple python main.py /path/torrent.torrent mydownloads
Hi, Downloading https://releases.ubuntu.com/21.10/ubuntu-21.10-desktop-amd64.iso.torrent gives this error.
ERROR:root:HTTP scraping failed: HTTPSConnectionPool(host='torrent.ubuntu.com', port=443): Max retries exceeded with url: /announce?info_hash=%F1%FC%DC%14b%D3e0%F5%26%C1%D9%40.%EC%91%00%B7%BA%18&peer_id=z%A7s%22%1E%B4%E1%DF%7F%ECR6%91%91%E3%24%A2%C6%3FO&uploaded=0&downloaded=0&port=6881&left=3116482560&event=started (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc7722b59d0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
Traceback (most recent call last):
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network is unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn
conn.connect()
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
conn = self._new_conn()
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fc7722b59d0>: Failed to establish a new connection: [Errno 101] Network is unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
resp = conn.urlopen(
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='torrent.ubuntu.com', port=443): Max retries exceeded with url: /announce?info_hash=%F1%FC%DC%14b%D3e0%F5%26%C1%D9%40.%EC%91%00%B7%BA%18&peer_id=z%A7s%22%1E%B4%E1%DF%7F%ECR6%91%91%E3%24%A2%C6%3FO&uploaded=0&downloaded=0&port=6881&left=3116482560&event=started (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc7722b59d0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/derrek/PycharmProjects/PyTorrent/pytorrent/tracker.py", line 89, in http_scraper
answer_tracker = requests.get(tracker, params=params, timeout=5)
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "/home/derrek/PycharmProjects/PyTorrent/venv/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='torrent.ubuntu.com', port=443): Max retries exceeded with url: /announce?info_hash=%F1%FC%DC%14b%D3e0%F5%26%C1%D9%40.%EC%91%00%B7%BA%18&peer_id=z%A7s%22%1E%B4%E1%DF%7F%ECR6%91%91%E3%24%A2%C6%3FO&uploaded=0&downloaded=0&port=6881&left=3116482560&event=started (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc7722b59d0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
ERROR:root:HTTP scraping failed: a bytes-like object is required, not 'list'
Traceback (most recent call last):
File "/home/derrek/PycharmProjects/PyTorrent/pytorrent/tracker.py", line 103, in http_scraper
ip = struct.unpack_from("!i", list_peers['peers'], offset)[0]
TypeError: a bytes-like object is required, not 'list'
if you don't want to fix this, any way you can point me in the right direction?
Not an issue just a FYI: pypubsub is now at https://github.com/schollii/pypubsub (I moved it from sourceforge and made some updates). Best regards!
There's no quick way to run the program by providing the torrent file from the command line itself.
Right now, the name of the torrent file is hard-coded which is considered bad practice. Using the sys module to take the torrent file name as an argument from the command line would be a quick fix and a QOL upgrade.
I was interested in possibly using your code, but I don't see a license specified.
Please include a license for your code. Thanks.
Hi,
Is it possible to continue seeding after a file has been downloaded?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.