Skip to content

Forum in maintenance, we will back soon 🙂

Notifications
Clear all

Python Script

43 Posts
4 Users
21 Reactions
1,019 Views
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@admin Thanks for explaning the rationale, it makes sense now. I was lost on the web scraping module because I couldn't get BeautifulSoup4 to install and also you used some code that you didn't explain - but now you said I don't need to understand it right now I am more relaxed.

Then there was mention of python virtual environments and setting them up and I was very confused as this is not covered in the traning moduel yet. I will continue with the course, but I do like to try the exercises if I can. Thanks

 

 

 
Posted : 04/06/2024 9:45 am
(@husein)
Posts: 550
Member Moderator
 

@google-rayazsiddiqi It is very normal not to remember all function names; you start memorizing them when you use them more and more in your code. 

The virtual environment is not covered since the course isn't concerned with it. However, it's very easy to set up, and the main reason to use it is that sometimes, as you've installed a lot of modules, some might affect others and won't work properly. So, a virtual environment is like a new machine with no previously installed modules.

 
Posted : 04/06/2024 9:59 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@google-rayazsiddiqi you can schedule time with me to discuss in person or you can research on YouTube what you don't understand.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 04/06/2024 12:16 pm
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@ssadvisor many thanks for that, is there a charge for the 121 session? What time zone are you in...I'm in UK?

 
Posted : 04/06/2024 11:21 pm
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@husein thank you, makes sense, how do you switch between virtual environments?

 
Posted : 04/06/2024 11:22 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@google-rayazsiddiqi EDT or UMC -4:00

There is no charge.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 04/07/2024 1:30 am
(@husein)
Posts: 550
Member Moderator
 

@google-rayazsiddiqi, do you mean to activate the virtual environment? If that's what you mean, and you named your virtual environment "venv" run the following:

venv\Scripts\activate
 
Posted : 04/07/2024 9:42 am
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@ssadvisor Thanks I'll be in-touch!

 
Posted : 04/08/2024 9:41 am
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

I tried this code:

from bs4 import BeautifulSoup
import requests
url="https://learnwithhasan.com"
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
title = soup.title
print(title)

An am getting this error, seems it cant find the requests module!

File "c:\Users\rayaz\web scraping.py", line 2, in <module>
import requests
ModuleNotFoundError: No module named 'requests'

 
Posted : 04/08/2024 3:59 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@google-rayazsiddiqi https://pypi.org/project/requests/

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 04/08/2024 6:35 pm
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@ssadvisor thanks how do I install this package...do I go to the URL you sent and download to my machine. Will the py script automatically locate it when I put in "Install requests"

 
Posted : 04/08/2024 6:40 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

The link I've given is to the documentation for the package including the instructions on how to install it. 

pip install requests

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 04/08/2024 9:45 pm
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@ssadvisor super it's working now

 
Posted : 04/09/2024 5:26 pm
Page 3 / 3
Share:
[the_ad_group id="312"]