I just came across googletrans python package. This package translates quite well and seems to use google translation API. To my knowledge, google translation API is not free. What googletrans doing internally for the translations? Is it legal to use googletrans?
The official documentation has information on this:
https://pypi.python.org/pypi/googletrans#how-does-this-library-work
You may wonder why this library works properly, whereas other approaches such like goslate won’t work since Google has updated its translation service recently with a ticket mechanism to prevent a lot of crawler programs.
I eventually figure out a way to generate a ticket by reverse engineering on the obfuscated and minified code used by Google to generate such token, and implemented on the top of Python. However, this could be blocked at any time.
As for the legality of this approach, this kind of stuff depends on the laws of the countries you live in, and is probably slightly off-topic.
Related
Im starting a new project for personal porpuse!
Im working personally in finance, I decided to create personal chart viewing software to suit my needs. I thought I'd create a good part of the backend in Python as it is a language I know quite well. Use Javascript for the graphic side, and use a webview in a windows form to make everything available as if it were software.
As for the graphics I thought of using: Lightweight Library for JS, I find that today it is the most avant-garde library compared to the classic plotly, matplotlib.
Use pywebview as a bridge between Python and JS and to redirect everything in a windows form.
However I find it a bit difficult to use this library (pywebview), there is a poor documentation around and not very clear to me (my level of JS is really basic). However, I believe it is one of the most convenient solutions.
I would have thought of using pyscript, but it still seems early to use this library in production.
Questions:
Do you think such a job is feasible?
Do you know other libraries/better solutions to do such jobs?
What kind of approach would you use if you were to do such work?
What I am trying to achieve is to write most of the functions in python and use only JS to make calls through buttons or to get data from various inputs.
Wandering around the web I found a work already partially created by this guy (if you are reading, Thanks Filipe you have been very helpful! here you can see his project hosted on Github) but unfortunately it is difficult for me to get my hands on a code not produced by me.
When learning python, I have a puzzle. Python has rich third-party libraries, but it makes me a novice difficult to use them. For example, when using Matplotlib, I just know what it can do, but specifically, for example, I want to draw a complex diagram, but I can't start with it, because there are many functions, but I don't know where they are, The introduction of the official manual sometimes feels a little abstract. If you go to Google and search a specific function, you may not get the desired result. So how do you quickly start a third-party library
One of the ways to get familiarised quickly with any 3rd party lib (python lib) is to go through getting started / Quickstart section of the documentation (for any library)
If that doesn't help then these two below sites have always helped me get a quick intro and basic hands-on for most of python libs
Real Python (https://realpython.com)
Tutorialspoint (https://www.tutorialspoint.com/index.htm)
Full-stack Python (https://www.fullstackpython.com) is another site I refer to when I have to find a new python library.
These sites pretty much cover almost all the well known python libraries.
And most of the famous libraries documentation sites provide a link to some sort of community on discord / Gitter / some site which would help further.
Example: Numpy
Learn section with Quickstart and other example based tuts
community section with links to several groups
Software these days can be separated into two categories: runs on client infrastructure (like in the case of enterprise software, like Splunk or Tibco), OR runs on the infrastructure of a software provider (like in the case of Facebook, where you need to use their API to access the backend).
In the first category, the client pays for a license and receives the software to run on their own machines on their premises of choice. The client IS in possession of the actual code and software.
In the second category, the software resides somewhere external and can be accessed only by an API. The client is NOT in possession of the software and can only use it to the extent allowed by the API.
My question is: in the first category above, how is the actual code kept hidden from the client?
Let's say I've built a really awesome analysis engine in Python for analyzing output logs. A corporate client is interested in using it for their internal applications. However, they insist that my engine must run on their own machines for security reasons. If I succumb and give them my Python code, then I will risk my intellectual property.
In that case, do I need to rewrite all my code into a compiled language like C++ to obfuscate it during compile time? Or is there a way to keep it in Python but secure the source code it in another way?
Update:
Given the answers below, in that case, would the more efficient pathway to developing a client-hosted application (i.e.: first category above) be to write a proof of concept in a more convenient language like Python first, and then take those ideas and rewrite it into C++?
The short answer is that you pretty much can't. You can do workarounds, but in the end almost anyone can reverse engineer your code no matter how you obfuscate it.
Your best bet might be to use something like PyInstaller and see if you can only include .pyc files. That doesn't protect you all the way, but it at least makes it a pain to reverse. You might even be able to find an obfuscater to run it first, but I don't know much about that part.
Similar to #gabeappleton's suggestion above, compile the Python code into an EXE. I use cx_freeze quite regularly and have good success. It's pretty well documented and reasonable support on these forums.
My answer is quite specific to the Betfair API however I would like to know how to use more APIs in general. I'm quite new to this sort of thing so don't really know how it works. I've just downloaded this package: https://github.com/jmcarp/betfair.py
My question is, how am I supposed to know the functions that come associated with it? How am I supposed to be able to know how to pull the data that I want from any given website without having any resource describing the functionality of the API?
These library is only a binding (with several errors) to Betfair APIs.
You can find documentation about this API, and therefore about this library, in Developer's web.
If you're interested in how to use Betfair APIs in Python you can take a look at Betfair's code samples.
I have some really nice Python code to do what I need to do. I don't particularly like any of the Python GUI choices though. wxPython is nice, but for what I need, the speed on resizing, refreshing and dynamically adding controls just isn't there. I would like to create the GUI in VB.NET. I imagine I could use IronPython to link the two, but that creates a dependency on a rather large third-party product. I was perusing the MSDN documentation on Windows IPC and got the idea to use sockets. I copied the Python echo server code from the Python documentation and in under 5 minutes was able to create a client in VB.NET without even reading the System.Net.Sockets documentation, so this certainly doesn't seem too hard.
The question I have is... is this a terrible idea? If so, what should I be doing instead?
If this is a good idea, how do I go about it?
It's not a terrible idea. In fact, if you write the Python code to have a RESTful interface, and then access that from VB.NET, it is a downright good idea. Later on you could reuse that Python server from any other application written in Python or VB.NET or something else. Because REST is standard and easy to test, people can even do GETs from a browser and maybe that will be useful in itself.
Here is a Yahoo page that gives you code examples to do REST GET, POST and so on, in VB.NET.
If you think REST has too much overhead and need something more lightweight, please don't try to invent your own protocol. Consider something like Google's Protocol Buffers which can also be used from VB.NET.
I think this is an excellent idea. I'll second Michael Dillon's recommendation for a REST API, and I'll further recommend that you use Django to implement your REST server.
I wrote a REST web service using Django, and Django made it really easy and fun. Django made it really simple to set up the URLs the way I wanted them, to run whatever code a URL called for, and to interact with the database as needed. My web service was rock solid reliable, and I was able to test it for debugging simply using a web browser.
If you already have your code working in Python and just want to slap on a glue interface, and if REST doesn't seem like what you want, you could look at the Twisted networking framework. Here is a nice article on how to do networking in Python with both the standard Python modules and with Twisted.