aztro: Error: Request failed with status code 400

Getting this error again and again Exact error : "message": "'NoneType' object has no attribute 'text'" Status : 400 Could you please tell me how to resolve or what is the issue

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 3
  • Comments: 21

Most upvoted comments

For those who need an alternative, here is a code that works to retrieve horoscope:

from bs4 import BeautifulSoup
import requests

signs = {
    "aries": 1,
    "taurus": 2,
    "gemini": 3,
    "cancer": 4,
    "leo": 5,
    "virgo": 6,
    "libra": 7,
    "scorpio": 8,
    "sagittarius": 9,
    "capricorn": 10,
    "aquarius": 11,
    "pisces": 12,
}

given_sign = "aries"

URL = "https://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-today.aspx?sign=" + \
    str(signs[given_sign])

r = requests.get(URL)
soup = BeautifulSoup(r.text, 'html.parser')

container = soup.find("p")

print(container.text.strip())

Gee that’s interesting, it’s going to be hard for Sameer to fix as this code has been scraping my website for years without me knowing and I’ve been paying $$$ to AWS for database and hosting fees. Unfortunately, I am not going to be bringing the website back as a free resource to be scraped anymore.

We built a replacement - same output

    Compatibility
    Lucky Number
    Lucky Time
    Color
    Date Range
    Mood
    Description

Ex horoscope:

Saturday, April 1st, 2023 (Moon in Leo): Scorpio, today you may feel a need for self-expression and creativity. You may want to showcase your unique talents and abilities. Use this energy to express yourself authentically and confidently. Some past events that occurred on this day include the founding of the city of Baghdad by the Abbasid caliph Al-Mansur. This event could be relevant to Scorpios as they may be seeking to establish a new cultural or intellectual center in their own lives.

We’d consider opening the service up to others. Not $0 but relatively low to what others are charging. But you’d have a usage license to the horoscopes vs. taking a risk on using other’s work.

Contact if interested: partnerships@twinflamedev.com

Hi, I made an issue on the PyAztro page.

The issue is that the source for the code, http://astrology.kudosmedia.net/ , appears to have died. Unless the website comes back up, Aztro is also not going to work.

The code would need to be completely rewritten to use another source, if such a source exists.

yes, even I am getting this error 400 from 29th March 2023. It was working fine until 28th March. Hopefully this gets fixed by Sameer asap…

Hey @Lekhrajk, I have the same error. Looking for ways to resolve the issue.

@leekuo I didn’t realise this was happening to your website but, if you won’t consider a free tier for the open-source community, who clearly rely on your source, rather than shut it down, perhaps a minimal charge could be introduced? This way we could assist in your AWS hosting fees & keep it open. I’d certainly support it. 😃

It bascically go on horoscope.com website and retrieve horoscope text posted there. It uses requests Python library to perform the http call and beautifulsoup library to parse and deal with the html. You just need to provide which sign you want to retrieve.