Closed regis57 closed 6 years ago
I suspect that the program is simply crashing since there are several problems with the above code, though you should be seeing that as soon as it is run. Are there no errors printed when you run it? If not, then that code may not be in the right place.
As for the problems:
'RYR3VG'
instead of the bare RYR3VG
,=
is an assignment in Python, two are a comparison, e.g. does a equal b should be written a == b
,if
statements end in a colon :
, and So combining items 1, 2 and 3, your comparisons should be written:
if flight == 'RYR3VG':
And for sanity sake, you could probably condense all of those if
statements by using a hash
or some other more Pythonic mechanism. Nothing wrong with a bunch of if's, but might be more easily maintainable another way, e.g.
flights_to_hashtags = {
'RYR3VG': " #RYANAIRPisaEindhoven",
'TUI1FX': " #TuninterPalmadeMallorcaDuesseldorf",
'RYR575F': " #RYANAIRRomeBrussels",
... many more here ...
}
if flight in flights_to_hashtags:
""" if the flight is in our hash, append its hashtag to the hashtags list"""
hashtags.append(flights_to_hashtags[flight])
Let us know how you get on.
flights_to_hashtags = { 'RYR3VG': " #RYANAIRPisaEindhoven", 'TUI1FX': " #TuninterPalmadeMallorcaDuesseldorf", 'RYR575F': " #RYANAIRRomeBrussels", ... many more here ... }
if flight in flights_to_hashtags: """ if the flight is in our hash, append its hashtag to the hashtags list""" hashtags.append(flights_to_hashtags[flight])
I tried what you explain on this last part. No success after monitoring for a bit. What error log do you need? Perhaps can we teamviewer?
Best regards,
So you are doing this all in tracker.py
? Is you version of that file available online somewhere, i.e. did you fork Kevin's repo? If not, can you post it to a site (don't paste it here) or to one of the various pastebins and either post or email a link?
@Jestre all in tracker.py I kinda only edited the hashtag part, not sure we can tell I forked it
here the pastebin:
I must already say that I intend to tell for v2, that if flight goes to luxembourg, Koln, stuttgart, Brussels, frankfurt (I have already flagged such flights in excel), I add additional tag #descente meaning plane is going to land soon, regardless of it's altitude level and direction. If flights are starting from these above cities, it will add hastag #decollage for takeoff.
I am not that proficient using if string, and python is an amazonian snake for me. I am just familiar to some business intelligence as I did some matching of existing flight numbers, to free online database of flightroutes, airline companies and airport location.
thank you PS: this is my ADSB twitter for info; https://twitter.com/Above_Malroy
I checked out your Twitter feed, and it appears to be working. Did you figure out the issue with the version you had in pastebin? Is all good now?
@Jestre on my twitter feed I publish basics, as per old version of tracker.py No flight route as hashtag... I need to replace the file for further test as the pasbin version is not working when I used it
I took a look at what you have in your pastebin and it looks like the indenting got a little mixed up for your dictionary, maybe try this: https://pastebin.com/7eB0Kcv6
@kevinabrandon 3 planes from my list came within 5km of my antenna, but no twitter post :( latest version : https://pastebin.com/15yxzTQ8
The latest release using the flightaware api is serving the purpose. Thank you. I just hope to no go over the free limit so fast.
I'm tweeting about 100 times a day, which puts me at about 3000 a month. I made sure to not select auto-upgrade. I just checked my billing status and it says this:
FlightXML3 Plan: Starter+
Auto-Upgrade: Off
Monthly Query Limit: 1,000
Queries Used: 1,223
Queries Left: -223
Billing Date: 26th of the month
So at least for now, if you go over they aren't limiting your requests. I imagine at some point they're going to put a stop to it though.
Hi,
After 2 month, I had requested my archive of Twitter, which had a CSV inside. It allowed me to find out most recurring flight number, and lookup for airline name, flight from, flight to mapping. Now I want to map each single flight I have identified (about 1200) to a 'unique' hashtag that consist of #AirlineAirportfromAirportto . My issue is the tracker.py files is ignored and no further twitter are posted when I intend to add this mapping.
1: is it possible? 2: what am I missing?
`hashtags = [] if flight = RYR3VG hashtags.append(" #RYANAIRPisaEindhoven") if flight = TUI1FX hashtags.append(" #TuninterPalmadeMallorcaDuesseldorf") if flight = RYR575F hashtags.append(" #RYANAIRRomeBrussels") if flight = RYR2SK hashtags.append(" #RYANAIRRomeEindhoven") if flight = EWG589 hashtags.append(" #EUROWINGSPalmadeMallorcaCologne") if flight = NLY3JC hashtags.append(" #FLYNIKIPalmadeMallorcaCologne") if flight = 400796 hashtags.append(" #InconnuInconnuInconnu") if flight = NLY6A hashtags.append(" #FLYNIKIPalmadeMallorcaDuesseldorf") if flight = NLY7611 hashtags.append(" #FLYNIKIPalmadeMallorcaCologne") if flight = NLY9ZR hashtags.append(" #FLYNIKIPalmadeMallorcaMunster") if flight = GMI3873 hashtags.append(" #GERMANIAPalmadeMallorcaMunster") if flight = GMI4571 hashtags.append(" #GERMANIAPalmadeMallorcaBremen")
I tried with a.flight instead of flight, results is same: no more twitter post.
thanks for your help