I'm trying to use the names module along with a wrapper for temp-mail.org (https://github.com/saippuakauppias/temp-mail) for part of a project involving creating temporary email addresses. My code is as shown below and works fine unless n is greater than 2.
import names from random import randint from tempmail import TempMail n = input("Please enter number of email addresses: ") i = 0 while i < n: first = names.get_first_name() second = names.get_last_name() tm = TempMail(login= first + "." + second + str(randint(1,99))) email = tm.get_email_address() print email i = i+1
If n is greater than two the loop will execute twice then I receive the following error:
>>> runfile('/root/voter.py', wdir='/root') Please enter number of email addresses: 3 [email protected] [email protected] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 714, in runfile execfile(filename, namespace) File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile builtins.execfile(filename, *where) File "/root/voter.py", line 12, in <module> email = tm.get_email_address() File "/usr/local/lib/python2.7/dist-packages/tempmail.py", line 66, in get_email_address available_domains = self.available_domains File "/usr/local/lib/python2.7/dist-packages/tempmail.py", line 36, in available_domains domains = req.json() File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 826, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 516, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I know this is a longshot as the tempmail module isn't widely used however I was hoping I've made a simple error elsewhere and someone could help? Thanks