Esempio n. 1
0
 def clean(self):
     cleaned_data = self.cleaned_data
     if not cleaned_data:
         return cleaned_data
     username = cleaned_data.get("username")
     password = cleaned_data.get("password")
     if not username or not password:
         return cleaned_data
     api = SmgApi(username, password)
     user = api.login(self.request)
     if not user:
         raise forms.ValidationError("Cannot login using SMG. Check username and password")
     return cleaned_data
 def handle(self, *args, **options):
     api = SmgApi('xxxx', 'xxxx')
     api.start()