Advertisement
Guest User

t411 api

a guest
Jul 23rd, 2014
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. import requests, json, urllib
  2.  
  3. class T411():
  4.     api = 'https://api.t411.me'
  5.    
  6.     def __init__(self, username, password):
  7.         r = requests.post( '%s/auth' % self.api, dict(username=username,password=password), verify=False )
  8.         j = json.loads( r.content )
  9.         self.header = dict(authorization=j['token'])
  10.  
  11.     def search(self, search, fields): #fields ne doit pas etre vide
  12.         url = '%s/torrents/search/%s?%s' % ( self.api, urllib.quote_plus(search), urllib.urlencode(fields) )
  13.         r = requests.get( url, headers=self.header, verify=False )
  14.         j = json.loads( r.content )
  15.         return j['torrents']
  16.  
  17.  
  18. t411 = T411(USERNAME,PASSWORD)
  19. print t411.search('naruto',dict(cid=406,limit=200))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement