This code technically works to login just fine. However, on successful login it prints both login successful, and login incorrect. on failed login it only prints login incorrect. I’m using python3, and selenium. I believe this may be a syntax error, but I’m just not sure how to fix it. I can hard-…
Tag: python
How to use the options to socket() for IPv6 multicast UDP?
I have a linux network interface that IPv6 multicast traffic is arriving on. There are both ICMPv6 packets and UDP packets arriving for the same multicast group. I’m trying to receive the UDP traffic. The code below is in Python but I don’t believe this is important; the Python library here is a p…
Update Airflow XCOM value in Database
How can I update any value in the XCOM table with: Is there any option like the following? Answer I solved my own question:
How to select filtering by associated entries collection in sqlalchemy
I have many-to-many relationships for users and roles and I want to select user which have specific roles using realtions. For example I want to get user having: so I tried (where roles – List[Roles]) but I got then I tried where roles already List[str] And I got but any() selects entry that has any ass…
VS Code indent or tabSize problem with error color
You can see in the image tab size problem or indent, why the red colour or error colour on the indent? How to fix the problem/error? you can see red color error Answer The problem is because you have the indent-rainbow extension installed, which makes multiple indents in your code highlighted in different col…
soup.select() returns an empty list
I have an issue with .select which always returns an empty list while practicing webscraping. I am working on the following page: https://presse.ania.net/news/?page=1 using BeautifulSoup. I am getting and parsing HTML as following: I try to retrieve the urls of each articles displayed on the page, under class…
POST request to TRIAS API does not work with requests
I maintain an API client for the TRIAS API (German Link) to retrieve local public transport information for various states / cities in Germany. Recently one of the TRIAS servers (Baden-Württemberg) started responding with an error message to requests. When I try to send the request via curl, the server respon…
Pandas – partition a dataframe into two groups with an approximate mean value
I want to split all rows into two groups that have similar means. I have a dataframe of about 50 rows but this could go into several thousands with a column of interest called ‘value’. So far I tried using cumulative sum for which total column was created then I essentially made the split based on…
chrome not reachable Selenium webDriverException
Option values when creating drivers On the remote server(ubuntu on EC2) via ssh, Attempt to run Python scripts using selenium via nohup python3 ~~. py> ~/log.out & It works well when maintaining the ssh connection with the server. But an error occurs a few seconds after disconnecting the ssh selenium.c…
How to add randomly elements to a column of dataframe (Equally distributed to groups)
Suppose I have the following dataframe: I want to groupby the dataset based on “Type” and then add a new column named as “Sampled” and randomly add yes/no to each row, the yes/no should be distributed equally. The expected dataframe can be: Answer You can use numpy.random.choice: outpu…