VedAstro.Python
VedAstro.Python copied to clipboard
API not getting connected
I am getting the below errors"
Traceback (most recent call last):
File "D:\Project\VedAstro.Python\demo_code_from_api_builder.py", line 13, in
And after debugging below :
AllHousePlanetsInHouseBasedOnSign response: {
"Status": "Pass",
"Payload": {
"AllHousePlanetsInHouseBasedOnSign": "System.Collections.Generic.Dictionary2[VedAstro.Library.HouseName,System.Collections.Generic.List1[VedAstro.Library.PlanetName]]"
}
}
AllHouseSignName response: {
"Status": "Fail",
"Payload": "Calculator method not found!"
}
Failed to get AllHouseSignName data: {'Status': 'Fail', 'Payload': 'Calculator method not found!'}
No data to combine.
Happy to help ☺ Please post your code, so I can run on my side. If possible please state your target? Perhaps a simple API Call can serve your needs.
This is the code. I am a noob in coding and trying to learn and build.
import requests import json import pandas as pd
print data nicely
def print_json_as_table(json_array): df = pd.DataFrame(json_array) print(df)
combines 2 arrays with common column House
def combine_json_arrays(json_array1, json_array2): combined_json_array = [] for obj1 in json_array1: for obj2 in json_array2: if obj1["House"] == obj2["House"]: combined_obj = {**obj1, **obj2} combined_json_array.append(combined_obj) return combined_json_array
set time & location
domainName = "https://api.vedastro.org" timeLocation = "Location/Kanpur,UttarPradesh,India/Time/17:15/19/11/2002/+05:30"
get needed data
url = f'{domainName}/Calculate/AllHousePlanetsInHouseBasedOnSign/{timeLocation}' rawData = requests.get(url).json()["Payload"] allPlanetHousePositionsBasedOnSignList = next(iter(rawData.values()))
url2 = f'{domainName}/Calculate/AllHouseSignName/{timeLocation}' rawData2 = requests.get(url2).json()["Payload"]
allHouseSignNameList = next(iter(rawData2.values()))
combine data
combined_json_array = combine_json_arrays(allPlanetHousePositionsBasedOnSignList, allHouseSignNameList)
print data
print_json_as_table(combined_json_array)
@dineshmrai apologies for the late reply 🙏 I've completely stopped touching the Python version almost 6 months. So unfortunately, I sincerely do not know how to solve the issue your facing. 😅 If you stumbled upon the solution please feel free to make PR 🙏😊
@dineshmrai very sorry for super long time it took to fix this 😅🙏🙏
But it has been fixed ✅✅ & demo code in repo as been updated to work 🚀