Advertisement
Guest User

libnotame.py

a guest
Nov 21st, 2010
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # libnotame.py para el uso de notame con python
  3. # patron url del api http://www.meneame.net/api/newpost.php?user=usuario&key=clave&text=texto
  4. # gnu/gpl v3 Patxi
  5.  
  6. import urllib
  7.  
  8. class Nota():
  9.   user = ""
  10.   apikey = ""
  11.   nota = ""
  12.   url = "http://www.meneame.net/api/newpost.php?"
  13.  
  14.   def setUser(self, user):
  15.     self.user = user
  16.    
  17.   def setApikey(self, apikey):
  18.     self.apikey = apikey
  19.    
  20.   def setNota(self, nota):
  21.     self.nota = nota
  22.  
  23.    
  24.   def send(self):
  25.     nota_data = urllib.urlencode({'user': self.user, 'key': self.apikey, 'text': self.nota})
  26.     self.url = self.url + nota_data
  27.     print self.url
  28.     feedback = urllib.urlopen(self.url).read()
  29.     return feedback
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement