Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Update peer_stores.py #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pythorrent/peer_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import socket
import random
from urlparse import urlparse
Copy link
Contributor Author

@tejt99 tejt99 Aug 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To Do:
Add cross-compatibility for py2 and py3

Edit:
No need

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take your viewpoint if you want to retain Python2 compatibility. It wouldn't be difficult, just need to do a try and look for an ImportError. urlparse in Python 2 and 3 seems similar enough to be all it should need. However, my preference would be to focus entirely on Python 3 as per expected Python 2.7 deprecation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

from urllib.parse import urlparse
from struct import unpack
from datetime import datetime, timedelta

Expand Down Expand Up @@ -54,7 +54,7 @@ def store_from_url(url):
class TrackerException(Exception):
pass

class Tracker(object)
class Tracker(object):
PEER = Peer
TRACKER_INTERVAL = 1800 # seconds

Expand Down Expand Up @@ -303,7 +303,7 @@ def scrape_request(self, connection_id):
)
self.send(request)

return parse_scrape_response(transaction_id, info_hash)
return parse_scrape_response(transaction_id, info_hash)

def parse_scrape_response(self, sent_transaction_id, info_hash):
buf = self.socket.recvfrom(2048)[0]
Expand Down