Category "python"

How to get product id and UPC in page source in Target?

I am trying to scrape some product ID and UPC of products in Target using Selenium in Python. I cannot find product id and UPC in product page so i go to the pa

Tweepy Python returns: 401 Unauthorized

So, I was trying to like a Tweet using Tweepy, but this error is occurring: Traceback (most recent call last): File "c:/Users/User/Desktop/VScode/Python/Fibra

flask sqlalchemy insert without session

HI is there is any way that I can insert a row to db without using session. A simple Example: try: db.session.add(user1) #in here I want to insert a row t

how to show success message without refreshing the page in django

I have a template called basket whenever I want to update the product quantity it works fine but the success message doesn't show until I refresh the page view

Decoding a python function where what's returned is a Iterator[Tuple] -

Imagine a function with a signature such as this: def read_something (file_name__path: str) -> Iterator[Tuple[Sequence1, Sequence2]]: If I am writing the fu

iOS - Failed to upload video file from swift to FastAPI server

I took the code for uploading the video file from this question, however, an error occurs. This is the code to select a video from an album: var videoURL: URL?

Scraping different years from Tableau

I have to scrape this table but it seems that TableauScraper does not recognise that multiple years are available. Here is the Table https://public.tableau.com/

finding CDRs in NGS data

I have millions of sequences in fasta format and want to extract CDRs (CDR1, CDR2 and CDR3).I chose only one sequence as an example and tried to extract CDR1 bu

Work around Keras TypeError limitation when calling layer "tf.keras.backend.rnn_1"

I am trying to use Keras for an attention mechanism in a machine translation using an LSTM network. However, I get a TypeError exception when in my code. TypeEr

Flask + sqlite + html

I need to make that when I click register on the site, the data is added as a new line in the database. But when the button is clicked, the site is simply updat

Getting "Failed to establish a new connection: [Errno -3] Temporary failure in name resolution" in Uvicorn server in Docker environment

I am getting the below exception while making a call from my project- My code is deployed on Docker and inside it running python uvicorn server. I have double c

Error while creating a model for binary classification for text classification

code: model = create_model() model.compile(optimize=tf.keras.optimizers.Adam(learning_rate=2e-5), loss=tf.keras.losses.BinaryCrossentropy(),

Issue converting object to int in Python for OLS regression

I'm trying to run a multiple linear regression in Python. One of my columns "member_total" is an object and I can't figure out how to convert it into an int. Ri

Azure App Service with AAD identity provider - Python & Streamlit framework for app - get logged in user

Have a web app developed in Python with the Streamlit framework. Deploying as an Azure app service. Authentication to the app is via AAD. I'm unable to get deta

How to deactivate a conda environment before the batch file exits when closing a jupyter lab instance?

I have a batch file that I use to run my jupyter lab. file.bat call <anaconda_dir>\Scripts\activate.bat rasa_ai_conda jupyter lab conda deactivate call co

Pydirectinput/Pynput/Pyautogui don't always press keys

So, I've been trying to make a macro for a game on Roblox and sometimes the inputs don't actually work? Why does this happen? I've tried this in pydirectinput,

Numba needs NumPy 1.20 or less for shapley import

I am trying to import shap. I am getting the following bug. I installed the lower version of NumPy still the problem is not solved. Thank you! import shap Im

How to understand closure in a lambda?

I want to make 5 buttons in a loop, and for each buttons bind a commend to print the index. In the following solution it always prints the same index. My code

How do I create a smtplib code that sends an 'Item in stock' email to a specific email address?

Using selenium I have a code that determines if an item is 'in stock' or 'out of stock'. The code can detect once an 'out of stock' item becomes 'in stock'. Usi

Multiple flask calls in single pytest having different databases

So I'm trying to test an endpoint in flask that I need to call multiple times in one test. The issue I am having is that on the second request the objects I pla