本文整理汇总了Python中tumblr.Api.auth_check方法的典型用法代码示例。如果您正苦于以下问题:Python Api.auth_check方法的具体用法?Python Api.auth_check怎么用?Python Api.auth_check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tumblr.Api
的用法示例。
在下文中一共展示了Api.auth_check方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testBadAuthenticate
# 需要导入模块: from tumblr import Api [as 别名]
# 或者: from tumblr.Api import auth_check [as 别名]
def testBadAuthenticate(self):
api = Api(BLOG, USER, 'badpassword' )
try:
api.auth_check()
assert False # should never get here
except TumblrAuthError, e:
pass
示例2: LoginController
# 需要导入模块: from tumblr import Api [as 别名]
# 或者: from tumblr.Api import auth_check [as 别名]
class LoginController(NSWindowController):
blog = objc.IBOutlet()
password = objc.IBOutlet()
user = objc.IBOutlet()
def init(self):
self.errors = {'403':'Login o password incorrectos','404':'Tumblrlog incorrecto','urlopen':'no ingreso su tumblrlog'}
return self
@objc.IBAction
def authTumblr_(self, sender):
self.p = self.password.stringValue()
self.u = self.user.stringValue()
self.b = self.blog.stringValue()
self.api = Api(self.b, self.u, self.p)
NSLog("Blog %s, User %s , Password %s" % (self.b, self.u, self.p))
try:
self.auth = self.api.auth_check()
self.destroy()
DashboardController.show()
except tumblr.TumblrAuthError:
print self.errors['403']
except tumblr.TumblrError(self):
print self.errors['404']
#except urllib2.HTTPError():
# print self.errors['404']
#except urllib2.URLError:
# print self.errors['urlopen']
def destroy(self):
app = NSApplication.sharedApplication()
appdelegate = app.delegate()
appdelegate.w.close()
示例3: Login
# 需要导入模块: from tumblr import Api [as 别名]
# 或者: from tumblr.Api import auth_check [as 别名]
class Login(gui.CeFrame):
def __init__(self):
gui.CeFrame.__init__(self, title="Opentumblr CE")
self.l_tumblr = gui.Label(self, "Tumblr", align = "center")
self.l_login = gui.Label(self, "Log in")
self.l_mail = gui.Label(self, "Email address")
self.tc_mail = gui.Edit(self)
self.l_password = gui.Label(self, "Password")
self.tc_password = gui.Edit(self, password = True)
self.l_blog = gui.Label(self, "Blog")
self.tc_blog = gui.Edit(self)
self.b_login = gui.Button(self, "Login")
self.b_login.bind(clicked = self.OnAuthTumblr)
self.__set_properties()
self.__do_layout()
def __set_properties(self):
pass
def __do_layout(self):
sizer_login = gui.VBox(border = (5,5,5,5), spacing = 5)
sizer_login.add(self.l_tumblr)
sizer_login.add(self.l_login)
sizer_login.add(self.l_mail)
sizer_login.add(self.tc_mail)
sizer_login.add(self.l_password)
sizer_login.add(self.tc_password)
sizer_login.add(self.l_blog)
sizer_login.add(self.tc_blog)
sizer_login.add(self.b_login)
self.sizer = sizer_login
def OnAuthTumblr(self, evt):
self.Blog = self.tc_blog.get_text()
self.User = self.tc_mail.get_text()
self.Password = self.tc_password.get_text()
self.api = Api(self.Blog, self.User, self.Password)
try:
self.auth = self.api.auth_check()
self.dashboard = Dashboard(self.api)
except tumblr.TumblrAuthError:
gui.Message.ok(title = 'Error', caption = 'Invalid email or password. Please try again')
示例4: testAuthenticate
# 需要导入模块: from tumblr import Api [as 别名]
# 或者: from tumblr.Api import auth_check [as 别名]
def testAuthenticate(self):
api = Api(BLOG, USER, PASSWORD )
api.auth_check()
示例5: Login
# 需要导入模块: from tumblr import Api [as 别名]
# 或者: from tumblr.Api import auth_check [as 别名]
class Login(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id)
self.parent = parent
self.p_main = wx.Panel(self, -1)
self.panel_login = wx.Panel(self.p_main, -1)
self.path_images = '/usr/share/pixmaps/opentumblr/dashboard/'
if not os.path.isdir(self.path_images):
if sys.platform == "win32":
self.path_images = os.path.abspath(os.path.dirname(sys.argv[0])) + '\\images\\'
else:
self.path_images = os.path.abspath('images') + '/'
self.bitmap_1 = wx.StaticBitmap(self.p_main, -1, wx.Bitmap(self.path_images + "opentumblr.png", wx.BITMAP_TYPE_ANY))
self.l_mail = wx.StaticText(self.panel_login, -1, "E-mail address")
self.cb_mail = wx.ComboBox(self.panel_login, -1, choices=[], style=wx.CB_DROPDOWN)
self.l_password = wx.StaticText(self.panel_login, -1, "Password")
self.tc_password = wx.TextCtrl(self.panel_login, -1, "", style=wx.TE_PASSWORD)
self.l_blog = wx.StaticText(self.panel_login, -1, "Blog")
self.tc_blog = wx.TextCtrl(self.panel_login, -1, "")
self.b_login = wx.Button(self.panel_login, -1, "Login")
self.Bind(wx.EVT_BUTTON, self.OnAuthTumblr, id = self.b_login.GetId())
self.__set_properties()
self.__do_layout()
def __set_properties(self):
self.SetTitle("Opentumblr")
self.l_mail.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
self.l_password.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
self.l_blog.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
self.panel_login.SetBackgroundColour(wx.Colour(255, 255, 255))
self.p_main.SetBackgroundColour(wx.Colour(47, 47, 47))
def __do_layout(self):
s_main = wx.BoxSizer(wx.VERTICAL)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer_login = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.bitmap_1, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 20)
sizer_login.Add(self.l_mail, 0, wx.ALL, 5)
sizer_login.Add(self.cb_mail, 0, wx.ALL|wx.EXPAND, 5)
sizer_login.Add(self.l_password, 0, wx.ALL, 5)
sizer_login.Add(self.tc_password, 0, wx.ALL|wx.EXPAND, 5)
sizer_login.Add(self.l_blog, 0, wx.ALL, 5)
sizer_login.Add(self.tc_blog, 0, wx.ALL|wx.EXPAND, 5)
sizer_login.Add((20, 20), 0, wx.ALL|wx.EXPAND, 5)
sizer_login.Add(self.b_login, 0, wx.ALL|wx.EXPAND, 5)
self.panel_login.SetSizer(sizer_login)
sizer.Add(self.panel_login, 1, wx.ALL|wx.EXPAND, 10)
sizer.Add((320, 155), 0, wx.ALL|wx.EXPAND, 5)
self.p_main.SetSizer(sizer)
s_main.Add(self.p_main, 1, wx.EXPAND, 10)
self.SetSizer(s_main)
s_main.Fit(self)
self.Layout()
self.Centre()
def OnAuthTumblr(self, event):
self.Blog = self.tc_blog.GetValue()
#if not self.Blog:
#self.Blog = ''
#assert False,self.Blog
#print "Conectado al blog primario: "
self.User = self.cb_mail.GetValue()
self.Password = self.tc_password.GetValue()
self.api = Api(self.Blog, self.User, self.Password)
#assert False,dir(self.api)
try:
self.auth = self.api.auth_check()
self.dashboard = Dashboard(None, -1, self.api, self.path_images)
self.dashboard.Show()
self.Close()
#print "Te haz logueado"
except tumblr.TumblrAuthError:
self.invalid = Invalid(self)
self.invalid.Show()
print errors['403']
except urllib2.HTTPError:
print errors['404']
except urllib2.URLError:
print errors['urlopen']