Giter Site home page Giter Site logo

sameerkumar18 / aztro Goto Github PK

View Code? Open in Web Editor NEW
266.0 14.0 71.0 141 KB

The Astrology API ๐Ÿ’ซ Get daily horoscope!

Home Page: https://aztro.sameerkumar.website

License: Apache License 2.0

Python 99.36% Procfile 0.64%
astrology horoscope api rest-api restful-api python zodiac-sign zodiac-api astro horoscope-api

aztro's Introduction

aztro - The astrology API

Free and open API. Needs no authentication

Travis Docs Maintenance yes SayThanks Paypal

aztro api logo

What is aztro?

aztro REST API allows developers to access and integrate the functionality of aztro with other applications. The API retrieves daily horoscopes for yesterday, today, and tomorrow.

Feel free to contribute on Github.

Why aztro?

aztro is for a developer who wants an API that provides horoscope info for sun signs such as Lucky Number, Lucky Color, Mood, Color, Compatibility with other sun signs, description of a sign for that day etc.

URL

POST: https://aztro.sameerkumar.website

Parameters

sign :

Name of the sign.

List of all signs - aries, taurus, gemini, cancer, leo, virgo, libra, scorpio, sagittarius, capricorn, aquarius and pisces.

day :

Day can be today,tomorrow or yesterday

Usage

POST: https://aztro.sameerkumar.website?sign= <sign> &day= <day>

Example

The following example is for sun sign aries -

cURL

curl -X POST \
'https://aztro.sameerkumar.website/?sign=aries&day=today'

Python

import requests

params = (
('sign', 'aries'),
('day', 'today'),
)

requests.post('https://aztro.sameerkumar.website/', params=params)

Node.js

var request = require('request');

var options = {
url: 'https://aztro.sameerkumar.website/?sign=aries&day=today',
method: 'POST'
};

function callback(error, response, body) {
if (!error && response.statusCode == 200) {
    console.log(body);
}
}

request(options, callback);

PHP

<?php

    //This function can be used in any PHP framework like laravel, wordpress, drupal, cakephp etc.

    function aztro($sign, $day) {
        $aztro = curl_init('https://aztro.sameerkumar.website/?sign='.$sign.'&day='.$day);
        curl_setopt_array($aztro, array(
            CURLOPT_POST => TRUE,
            CURLOPT_RETURNTRANSFER => TRUE,
            CURLOPT_HTTPHEADER => array(
                'Content-Type: application/json'
            )
        ));
        $response = curl_exec($aztro);
        if($response === FALSE){
            die(curl_error($aztro));
        }
        $responseData = json_decode($response, TRUE);
        return $responseData;
    }

    $ObjData = aztro('aries', 'today');
    var_dump($ObjData);

?>

jQuery Ajax ^^^^^^ .. code-block:: javascript

$.ajax({

type:'POST', url:'https://aztro.sameerkumar.website?sign=aries&day=today', success:function(data){ console.log(data); } });

ECMAScript (ES6) ^^^^^^ .. code-block:: javascript

const URL = 'https://aztro.sameerkumar.website/?sign=aries&day=today'; fetch(URL, { method: 'POST' }) .then(response => response.json()) .then(json => { const date = json.current_date; console.log(date); });

Vue.JS using axios

<ul id="aztro">
    <li>Current Date: {{data.current_date}}</li>
    <li>Compatibility: {{data.compatibility}}</li>
    <li>Lucky Number: {{data.lucky_number}}</li>
    <li>Lucky Time: {{data.lucky_time}}</li>
    <li>Color: {{data.color}}</li>
    <li>Date Range: {{data.date_range}}</li> 
    <li>Mood: {{data.mood}}</li>
    <li>Description: {{data.description}}</li>
</ul>
const URL = 'https://aztro.sameerkumar.website/?sign=aries&day=today';
new Vue({
    el: '#aztro',
    data() {
            return {
            data: {}
        }
    },
    created() {
        axios.post(URL).then((response) => {
            this.data = response.data
        })
    }
})

ReactJS with ES6 ^^^^^^ .. code-block:: jsx

import React, { Component } from 'react';

class Aztro extends Component {
constructor(props){

super(props); this.state = { json: {} }

}

componentDidMount () {

const URL = 'https://aztro.sameerkumar.website/?sign=aries&day=today'; fetch(URL, { method: 'POST' }).then(response => response.json()) .then(json => { this.setState({json}); });

}

render() {
return (
<div>

Current Date: {this.state.json.current_date} <br /> Compatibility: {this.state.json.compatibility} <br /> Lucky Number: {this.state.json.lucky_number} <br /> Lucky Time: {this.state.json.lucky_time} <br /> Color: {this.state.json.color} <br /> Date Range: {this.state.json.date_range} <br /> Mood: {this.state.json.mood} <br /> Description: {this.state.json.description} <br />

</div>

);

}

}

export default Aztro;

Golang

package main

import (
    "fmt"
    "log"

    "github.com/irfansofyana/go-aztro-api-wrapper/aztro"
)

func main() {
    aztroClient, err := aztro.NewAztroClient()
    if err != nil {
        log.Fatal(err)
    }

    aztroParam := aztro.NewAztroRequestParam(aztro.Taurus)
    todayHoroscope, aztroErr := aztroClient.GetHoroscope(aztroParam)
    if aztroErr != nil {
        log.Fatal(aztroErr)
    }
    fmt.Println(todayHoroscope) // Get today's horoscope

    tmrrowParam := aztro.NewAztroRequestParam(
        aztro.Taurus,
        aztro.WithDay(aztro.Tomorrow),
    )
    tmrrwHoroscope, aztroErr := aztroClient.GetHoroscope(tmrrowParam)
    if aztroErr != nil {
        log.Fatal(aztroErr)
    }
    fmt.Println(tmrrwHoroscope) // Get tomorrow's horoscope
}

Response

{"current_date": "June 23, 2017", "compatibility": " Cancer", "lucky_time": " 7am",
 "lucky_number": " 64", "color": " Spring Green", "date_range": "Mar 21 - Apr 20",
 "mood": " Relaxed", "description": "It's finally time for you to think about just
  one thing: what makes you happy. Fortunately, that happens to be a person who feels
  the same way. Give yourself the evening off. Refuse to be put in charge of anything."}

Tests

pip install nose
nosetests tests

Projects using aztro API

Repository Description
Community Driven Radio A radio station driven by the community
Horoscope Apple Watch App Apple Watch Application for Horoscope
Your Daily Horoscope React app which shows your daily horoscope

Used aztro API in your project? Check out the contributing guidelines for this list and let us know. we love PRs :)

API Wrappers

For Python - PyAztro (pip install pyaztro)

For NodeJS - aztro-js (npm install aztro-js)

For Golang - go-aztro-api-wrapper (go get github.com/irfansofyana/go-aztro-api-wrapper)

License

2021 Sameer Kumar

Licensed under the Apache License, Version 2.0 (the "License");

http://www.apache.org/licenses/LICENSE-2.0

Contact

Questions? Suggestions? Feel free to contact me at [email protected]

Buy me a coffee ๐Ÿฅค

If this project helped you reduce the development time, please consider donating :)

Credits

"aztro" was created by Sameer Kumar and these awesome individual contributors

Source of horoscope updates - http://astrology.kudosmedia.net/

Please feel free to use and adapt this small API.

aztro's People

Contributors

dependabot[bot] avatar escrichov avatar gigkokman avatar irfansofyana avatar prateek54 avatar sameerkumar18 avatar sanchezg avatar sergekashkin avatar shreyansdjp avatar srijitcoder avatar vaibhav 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

aztro's Issues

API dont work

im trying to access your api and it connects me to your document website is this api closed? can anybody help me?

Cross origin issue - No 'Access-Control-Allow-Origin' header is present on the requested resource

Hi there,

I am using this API with React.js and giving cross-origin issue, below are the error:-

Access to XMLHttpRequest at 'https://aztro.readthedocs.io/en/latest/' (redirected from 'https://aztro.sameerkumar.website/?sign=aries&day=today') from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I will suggest you to add headers in your backend.

thanks :)

Add tests

For the different involved methods

'NoneType' object has no attribute 'text'

Hello i am facing issue on api now... it was working fine before.... but now its retrun below json
{
message: "'NoneType' object has no attribute 'text'"
}

I am using php post method for it

Can you help me here to resolve it, please?

Add timezone parameter

The timezone of the source for the info on the server side is set to "America/New_York, GMT-0400".
It would be great if we could have one parameter for the timezone as there are many users of this API from various parts of the globe.
Example -
POST: https://aztro.herokuapp.com?sign= <sign> &day= <day> &tz= <GMT_Timezone>

We can consider the standard timezone as GMT and enable this conversion just for "day=today"

Can you build a webhook?

Hey Sameer.

Great work. I would like to use this. Can you help me converting this into a webhook?

Regards,
Krishna

Is this legal???

Looked at the astrology.py source file and it's scraping horoscopes from astrology.kudosmedia.net instead of generating them. Do you own kudosmedia or have a license from them to do this and encourage others to?

Not sure what their deal is. The last item in their news section is from 2010 and they've still got flash on the homepage.

Not accusing you of anything untoward, but I wouldn't want to implement this in a project and then find out I was pirating someone else's content by proxy, so I gotta ask.

Returns Nothing But a Number

Python code returns <Response [200]>
Is this an error code?
Maybe put some information up on what the API returns when there's an error?
Maybe some more detailed code?

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

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.