python can load modules from remote server?

独自空忆成欢 提交于 2019-12-13 01:35:03

问题


in python,can i load a module from remote server to local? what i do this is want to protect my source code. what should i do ,thanks


回答1:


it can be done via python import hooks. see knockout for an implementation that you can either use directly or as a starting point to add further code-protection logic




回答2:


A bit off topic but if source protection is what you need C-compile your python source with cython and distribute .pyd files.

You'll have to:

  1. adapt your source to be cython compilant (not all code can be converted)
  2. precompile .pyd files for platforms you want to support (Windows, Ubuntu, Fedora etc...)



回答3:


Yes, you can import your code in creative ways.

No, it will not protect the code from being seen. Rethink your strategy, not tactics.



来源:https://stackoverflow.com/questions/5470161/python-can-load-modules-from-remote-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!