I have a question regarding writing Desktop applications in Python using the Soundcloud API. My problem is how can I implement a login functionality in my Desktop application without disclosing my client Secret. Because in order to get a login token I need to initialize the client with my client ID and secret. Is it possible somehow? Or do I have to use the Java or Objective-C API?
Or is it save to create Python bytecode and than publish my application? I haven't much experience with Python bytecode. Is it possible to extract variables or constants from the *.pyc file?
Related
I have python code that uses Gmail API for fetching unread emails and adding labels according to some rules.
The code runs on my computer and I wish to create a Gmail add-on for this labeling, the add-on should include a new button in the Gmail interface.
The problem is that Google add-on uses google app script.
I want to ask if there is a possibility to embed my python code into the google app script?
Thanks :)
You might use Python with Google Apps Script API to programmatically create and modify a Google Apps Script project, but the Google Apps Script uses V8 as it's runtime, and it requires JavaScript.
You might use Google Cloud Run (see https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service) or another hosting infrastructure to use Python to use the Card Service to build the add-on user interface and use the Gmail API.
I think that it might be possible to use Google Colaboratory as the hosting infrastructure but I have no idea how convenient it will be compared to use Google Cloud Run.
I want some help with the database implementation in my project.
The final implementation:
Website:
I want to make a (flask) website where the user can create or delete an account.
Desktop application:
I also want to make a (PyQt) python application that the user can log in to his/her account via a login prompt.
Database:
I want to make a (firebase) database so the users can authenticate. The database will also collect some user information except the authentication credentials.
The implementation until now:
Firebase:
I created a “web app” in firebase so I communicate with firebase via firebaseConfig
Flask website:
I created a flask website that communicates with the firebase via the firebaseConfig. The user fills in a form, and the firebase authentication creates a user via (create_user_with_email_and_password). The database, also, collects some extra user information.
(I think that my code is “safe” as it is server-side)
The problem:
Python application:
I created a python application that the user can log in to the firebase authentication. The problem I faced is that I “have to” include the firebaseConfig in my python code. With the firebaseConfig I can create and delete users, but I don’t want the other users to have the ability to do this.
(so I think my code is unsafe because the communication with the firebase is client-side so someone may decompile the code and get the firebaseConfig).
What is the best way to make my project safer?
It sounds like you're using the Firebase Admin SDK for Python, which (like all Admin SDKs) runs with elevated privileges and should only be used in trusted environments (such as your development machine, a server that you control, or Cloud Functions/Cloud Run).
There is no Firebase-provided SDK for use in Python applications that you ship to regular users of your app. That means that your options are limited to either using the REST API to sign in with Firebase, or to use a 3rd party library, such as Pyrebase (be sure to not use a service account there, as that'd make it run with the same elevated privileges as the Admin SDK).
Hi I want to access an application that is behind OKTA sso. I am using python requests module for accessing the application. Before Okta I was able to access the application with userid and password from my python script. But after okta the script is failing to access the application.
what modification I need in my Python script using requests module
From what I understand, there is a big chance you want to access an application using Okta issued token.
You need to reach out to the application developers to identify how to properly retrieve a token. There are lots of ways to authenticate using Okta and without more information it's gonna be hard to help you out.
Once you have all those information you should be able to use any python module providing requests authentication classes for the authentication flow that you have to use.
Disclaimer: I wrote requests-auth providing Okta authentication classes that can be used with requests (nominated in the Okta developer community award).
I want to create pods, manage replica sets, and deployments using a rest API either built with PHP or Python. This needs to be controlled from a web app where the user clicks on a button and a new pod with a specific volume is created. I'm not sure how to achieve this.
I came across KC8 API and Python KC8 client API but I'm unable to achieve what is required. TIA
Kubernetes is controlled through an HTTP REST API, which is fully specified here. You could write a web app that directly issues the appropriate HTTP requests to the Kubernetes API server.
However, it's much more recommended to use one of the Kubernetes client libraries that exist for different programming languages. These libraries wrap all the HTTP requests in function calls and also take care of things like authentication.
You can find example code using the different client libraries in the GitHub repositories of most libraries (see here).
I have not found a satisfactory answer/tutorial for this, but I'm sure it must be out there. My goal is to access Google Drive programmatically using my credentials. A secondary and lower-priority goal is to do this properly and that means using OAuth rather than ClientLogin.
Thus: How do you authenticate with the Google Drive API using your own credentials for your own Google Drive (without creating an application on the Google Developers Console)?
All of the documentation assumes an application, but what I'm writing is merely helper scripts in Python 2.7 for my own benefit.
"How do you authenticate with the Google Drive API using your own credentials for your own Google Drive (without creating an application on the Google Developers Console)?"
You can't. The premise of OAuth is that the user is granting access to the application, and so the application must be registered. In Google's case, that's the API/Cloud Console.
In your case, there is no need to register each application that uses your helper scripts. Just create an app called helper_scripts, embed the client Id in your script source, and then reuse those scripts in as many applications as you like.