Giter VIP home page Giter VIP logo

codingforentrepreneurs / 30-days-of-python Goto Github PK

View Code? Open in Web Editor NEW
2.1K 2.1K 1.3K 62.86 MB

Learn Python for the next 30 (or so) Days.

Home Page: https://cfe.sh/projects/30-days-python-38

License: MIT License

Python 0.19% HTML 88.58% PowerShell 0.01% Shell 0.01% Jupyter Notebook 11.22%
api automation csv fastapi flask jupyter pandas python python3 rest-api selenium selenium-webdriver tutorial web-scraping

30-days-of-python's People

Contributors

codingforentrepreneurs avatar jmitchel3 avatar mukul09 avatar patel-himanshu avatar teamcfe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

30-days-of-python's Issues

csv problem

my csv file written with python has blank lines between each row

Day 16 Selenium 4.3.* changes

Selenium made several changes, especially to find_element and find_elements and they depreciated the find_by_* calls.

Documentation on "https://selenium-python.readthedocs.io/installation.html" is outdated
Best Documentation can be found on "https://www.selenium.dev/documentation/webdriver/elements/locators/"

The following code can log users into Instagram and clear the 2 messages as of 27 Sept 2023

HTH

`import getpass
#my_password = getpass.getpass("What's your password?\n")
#print(my_password)

from conf import INSTA_USERNAME, INSTA_PASSWORD
from selenium import webdriver
from selenium.webdriver.common.by import By ##***Helpful in 4.3.

import time

browser = webdriver.Chrome()
url = 'https://instagram.com'
browser.get(url)
time.sleep(1)

username_el = browser.find_element(By.NAME,'username').send_keys(INSTA_USERNAME)
password_el = browser.find_element(By.NAME,'password').send_keys(INSTA_PASSWORD)
submit_btn_el = browser.find_element(By.XPATH, "//button[@type='submit']");
time.sleep(1)
submit_btn_el.click()
time.sleep(3)

body_el = browser.find_element(By.CSS_SELECTOR,"body")
html_text = body_el.get_attribute("innerHTML")
"""
Need to clear the Save your login

Not Now
"""

not_now_el = browser.find_element(By.XPATH, "//div[contains(text(),'Not Now')]")
not_now_el.click()

"""
Also need to clear the Turn on Notifications
"""

notifications_not_now_el = browser.find_element(By.XPATH, "//button[contains(text(),'Not Now')]")
notifications_not_now_el.click()
`

Fail to clone it using github desktop

Hi, I get the following error message when I try to clone the whole repository with github desktop... any idea why? Never had this error term before.
Btw thanks for this series of amazing tutorials!
image

problem in string encoding

yelp_soup=BeautifulSoup(yelp_r.text,'html.parser')

print(yelp_soup.prettify())
Traceback (most recent call last):
File "", line 1, in
File "C:\Python34\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2019' in position 33349: character maps to

csv Error when "open(filename,"rb") as csvfile" with python 3.6.2

it is day16 practise:
with open(filename,"rb") as csvfile,temp_file:

i got error as below:
Traceback (most recent call last):
File "rw_CSV_function.py", line 56, in
edit_data(email="[email protected]",amount=99.99,sent="")
File "rw_CSV_function.py", line 38, in edit_data
writer.writeheader()
File "C:\Python36\lib\csv.py", line 144, in writeheader
self.writerow(header)
File "C:\Python36\lib\csv.py", line 155, in writerow
return self.writer.writerow(self._dict_to_list(rowdict))
File "C:\Python36\lib\tempfile.py", line 483, in func_wrapper
return func(*args, **kwargs)
TypeError: a bytes-like object is required, not 'str'

i don't know how to fix this problem, can u please help me?

os error

Traceback (most recent call last):
File "", line 28, in
File "C:\Python36\lib\os.py",
line 210, in makedirs
makedirs(head, mode, exist_ok)
File "C:\Python36\lib\os.py",
line 220, in makedirs
mkdir(name, mode)
OSError: [WinError 123] The filename, directory name, or volume label syntax is
incorrect: 'C:\Python36\emails\Thu, 30 Jul 2015 21:50:34 -0700'

UnicodeEncodeError [RESOLVED]; RuntimeError: Event loop is closed [OPEN]

Upon running the scipt, I got 2 errors:

  1. UnicodeEncodeError: 'charmap' codec can't encode character <some-character> in position <some-position>: character maps to <undefined>
    SOLUTION: add following parameter to output_file.write_text(...): encoding="utf-8"

  2. RuntimeError: Event loop is closed
    Did anyone resolve this error?

name 'table_data_dicts' is not defined

Traceback (most recent call last):
File "scrape.py", line 96, in
run(start_year=start, years_ago=count)
File "scrape.py", line 77, in run
finished = parse_and_extract(url, name=start_year)
File "scrape.py", line 56, in parse_and_extract
table_data_dicts.append(row_dict_data)
NameError: name 'table_data_dicts' is not defined

Day-10 - 'new_dl_path' is not defined

When running the download_from_url.py, an error occurs:
Traceback (most recent call last): File "download_from_url.py", line 27, in <module> download_file(url, DOWNLOADS_DIR) File "/private/tmp/30-Days-of-Python/tutorial-reference/Day 10/download_util.py", line 12, in download_file return new_dl_path NameError: name 'new_dl_path' is not defined

Changing the new_dl_pathvariable name to dl_path in download_util.py solves the issue.

missing 2 required positional arguments python

For code in Classes 3 Day 9 it is showing "missing 2 required positional arguments python" after compiling. `import datetime

class MessageUser():
user_details = []
messages = []
base_message = """
Hi {name}!
Its been good to have you with us on {date} for the course.
The total amount for your course is Rs.{total}.
Have a great day !!!
"""

def add_user(self, name, amount):
    amount = "%.2f" %(amount)
    detail = {
        "name": name,
        "amount": amount,
    }
    today = datetime.date.today()
    detail['date'] = today
    self.user_details.append(detail)

def get_details(self):
    return self.user_details

def make_messages(self):
    if len(self.user_details) > 0:
        for detail in self.get_details():
            name = detail["name"]
            amount = detail["amount"]
            date = detail["date"]
            message = self.base_message
            new_msg = message.format(
                name=name,
                date=date,
                total=amount
             )
            self.messages.append(new_msg)
        return self.messages
    return[]

obj = MessageUser()
obj.add_user("Playstation", 230000)
print(obj.add_user())

`

Day 12 python3 pip install requests_html failed on mac

I have a question , I can't install the module requests_html on MacOS Catalina ,
and have errors as follows , Can you help me ?

  *********************************************************************************
  Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
  Perhaps try: xcode-select --install
  *********************************************************************************
  error: command '/usr/bin/clang' failed with exit code 71
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for lxml
Failed to build lxml
ERROR: Could not build wheels for lxml, which is required to install pyproject.toml-based projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.