Skip to content

Instantly share code, notes, and snippets.

@cas--
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cas--/a4be1a9275231a255131 to your computer and use it in GitHub Desktop.
Save cas--/a4be1a9275231a255131 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import libtorrent as lt
import time
session = lt.session(flags=0)
print('Session started: ', lt.version)
h = session.add_torrent({'ti': lt.torrent_info('../T1.torrent'), 'save_path': './lt_test_data'})
h.auto_managed(False)
session.set_alert_mask(lt.alert.category_t.error_notification | lt.alert.category_t.status_notification)
session.listen_on(15814, 15814)
proxy_settings = lt.proxy_settings()
proxy_settings.hostname = u''
proxy_settings.port = 0
session.set_i2p_proxy(proxy_settings)
time.sleep(1)
alerts = session.pop_alerts()
for alert in alerts:
print(type(alert).__name__, alert.message())
print('Exiting...')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment