PyGithub, no puede get repos de la empresa

Estoy creando un bot con Spark (chat para empresas), en Python, uso PyGitHub para librairy. Entonces, cuando escribo "repos" en mi habitación con el robot, él tiene que enviarme la list de mis repos. Funciona bien con mi count personal github pero no con mi count profesional. Si me puedes explicar por qué? aquí mi código:

def gitTest(self, details, message): url = "https://enter-prise.com" token = "abcd" github = Github(token, base_url=url) for repo in github.get_organization("org").get_repos(): self.answer(details.roomId, markdown=repo.name) Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1997, in __call__ return self.wsgi_app(environ, start_response) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1985, in wsgi_app response = self.handle_exception(e) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1540, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/mflamant/Documents/bot/CiscoSparkPython/testbotforgithub/main.py", line 44, in Main bot.isRunnable() File "/home/mflamant/Documents/bot/CiscoSparkPython/testbotforgithub/utils/Compute.py", line 47, in isRunnable self.spark(message[0], message[1]) File "/home/mflamant/Documents/bot/CiscoSparkPython/testbotforgithub/testbotforgithub.py", line 33, in spark return self.answer(details.roomId, markdown=self.gitTest(details, message)) File "/home/mflamant/Documents/bot/CiscoSparkPython/testbotforgithub/testbotforgithub.py", line 56, in gitTest for repo in github.get_organization(adt).get_repos(): File "/usr/local/lib/python2.7/dist-packages/PyGithub-1.35-py2.7.egg/github/Organization.py", line 539, in get_repos self.url + "/repos", TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' 

¿Puedes explicarme qué pasa con mi código? gracias

Si gitTest es un método de instancia, debe asignarle el atributo self.url , no solo a la url variable local. Entonces su método probablemente debería verse así:

 def gitTest(self, details, message): self.url = "https://enter-prise.com" self.token = "abcd" github = Github(token, base_url=url) for repo in github.get_organization("org").get_repos(): self.answer(details.roomId, markdown=repo.name) 

Es por eso que pasa la reference a self como primer argumento de cualquier método de instancia.

    Intereting Posts