1

I like the idea of GitHub Gists. That's where I, and many others, keep their tiny but handy Python modules. It would be nice to be able to directly import them to Python. Something like this:

import gist(url) as myModule

Is this possible? Is the only way just to extract the text from the gist and run eval on it?

Miladiouss
  • 4,270
  • 1
  • 27
  • 34

1 Answers1

3

Possible solution would be to download the gist from the url using requests. Then take the file name and import it using import example_file. You could also use a for loop to import all modules found within a directory.

I highly recommend not using eval() as when used with user input, can be used maliciously.

Ben10
  • 500
  • 1
  • 3
  • 14