flight offer search not pulling all air fares - python-3.x

I would like to seek help on the codes below.
Apparently, the code works by pulling out air fares but it seems like it does not pull out all the available air fares that I can see directly from the airlines websites.
Could anyone please assist me to let me know what's happening? Thanks!
from amadeus import Client, ResponseError
Origin = "SIN"
Destination = "CDG"
amadeus = Client(hostname='production', client_id='HIDDEN', client_secret='HIDDEN')
try:
'''
Find the cheapest flights from Origin to Destination
'''
response = amadeus.shopping.flight_offers_search.get(
#originLocationCode=Origin, destinationLocationCode=Destination, departureDate='2023-04-04', adults=1)
originLocationCode=Origin, destinationLocationCode=Destination, departureDate='2023-03-03', returnDate='2023-04-04', travelClass='BUSINESS', includedAirlineCodes='SQ', currencyCode='SGD', adults=1)
print(response.data)
except ResponseError as error:
raise error

The Self-Service APIs only return public fares coming from the GDS. That means that you will find discrepancy for both the flights and the prices too comparing to some websites you might visit.
For more details check the section carriers and rates in the developer guides.

Related

Binance api endpoint for fiat deposits from bank card?

I didn't find a history of fiat deposits(from bank card),
Only crypto deposits here: https://prnt.sc/ttdwc2=)
For example in my bank account interface I found deposit on 12th of may, but can't find it here...
Anyone know may be there is api endpoint to look for it?
Didn't find anything here https://github.com/binance-us/binance-official-api-docs/blob/master/rest-api.md
Once again: I didn't find anything about fiat deposits in api and website interface. It looks weird that there is no such way to see fiat history of deposits from credit cards.
May be I am missing something?
As far as i understand for today there is no such an endpoint for 02.28.2021
if anything changes it would be great
Or may be not great cause of taxes
This was annoying me for a while but it looks like Binance devs have added some functionality.
I have started to use the binance-connector python package. It just makes it easier to navigate the API (no need to hash your keys). You can find more info here:
https://github.com/binance/binance-connector-python
The code I used:
from binance.spot import Spot as Client
from datetime import datetime
# api_key and secret_key you get when you set up your API on Binance
spot_client = Client(api_key, secret_key)
currTime = round((time.time()*1000))
startTime = "01/01/2021"
beginTime = round(datetime.strptime(startTime, "%d/%m/%Y").timestamp()*1000)
params = {
"beginTime": beginTime,
"endTime": currTime
}
# 0 = deposit, 1 = withdrawals
# if no beginTime and endTime specified will give last 30 days
spot_client.fiat_order_history(0, **params)
More info here:
https://binance-docs.github.io/apidocs/spot/en/#fiat-endpoints

How to access Clockify API through Excel Power Query

I am new to Clockify and to API usage (so I apologize if I express myself not properly). My objective is to automatically load in Excel (via Power Query) the detailed report with all time entries. I have tried the below code and it works ... but for the fact that I got just the latest 50 time entries.
This because, as I understand properly, I should use this base Endpoint: "https://api.clockify.me/api/v1" (the one I use is deprecated). Is there a way to make the below work on the correct Endpoint?
let Source = Web.Contents("https://api.clockify.me/api/reports/{your report ID}", [https://api.clockify.me/api", #"X-Api-Key"="{your API Key}"]]), jsonResponse = Json.Document(Source), workspace = jsonResponse[workspace] in workspace
Thanks in advance,

How to check the country origin of a url

I have a list of url's and want to find out their country of origin via python 3. And was wondering if anyone could help.
For example: quikr.com or kooora.com
Thanks
You can use
geoip2
either via a database, you need to download (which I did) or create an account.
Thanks #AlexVorndran for the initial help.
Code example:
import geoip2.database
import socket
ip = socket.gethostbyname('nike.com')
reader = geoip2.database.Reader('GeoLite2-Country_20190305/GeoLite2-Country.mmdb')
response = reader.country(ip)
response.country.iso_code # Results in 'US'

Amazon Product Search API Python UPC

I am using this code to search for products on amazon. Is there a way for me to look the product up by UPC?
from amazon.api import AmazonAPI
amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)
product = amazon.lookup(ItemId='B00EOE0WKQ')
product.title
Well answer a bit late but for the sake of future genertions...
You can find all possible lookup types in scraper's documentation
Anyway to lookup object by UPC you use
api = API(locale='uk')
api.item_lookup([UPC], SearchIndex='Books', IdType='UPC')
Disclaimer: I do not have python-amazon-simple-product-api installed. (I use python-amazon-product-api 0.2.8)
However, I do believe that adding IdType='UPC', and SearchIndex='All' to your amazon.product call should get you closer.
e.g.:
product = amazon.lookup(ItemId='028000467012', IdType='UPC', SearchIndex='All')
also, be sure to use the IdType that matches your ItemId, to avoid errors.

Google maps directions from A to B considering traffic

Is there any way to get google maps directions from A to B with considering traffic at the moment of calling the function?
This code below works fine if it is empty road:
var gm = require("googlemaps");
gm.directions("from", "where go to" , function ( err, data ) {
console.log(data.routes[0].legs[0].distance);
console.log(data.routes[0].legs[0].duration);
}, "false");
I am new to google maps, so please any thought to spare?
A quick look at the documentation gives you a clear answer:
durationInTraffic (optional) specifies whether the DirectionsLeg result should include a duration that takes into account current traffic conditions. This feature is only available for Maps for Business customers. The time in current traffic will only be returned if traffic information is available in the requested area.

Resources