FlightAware Discussions

Anyone know why the code I scraped from the documentation doesnt work?

I want to use the FlightXML API to get some data. I’m a beginner when it comes to this kind of python usage so please forgive me if I ask noob questions. So I copied the code which uses the module suds from the python example available in the docs as shown below and I entered my username and API key.

import sys
from suds import null, WebFault
from suds.client import Client
import logging


username = 'devanjithf'
apiKey = 'blahblah'
url = 'http://flightxml.flightaware.com/soap/FlightXML2/wsdl'

logging.basicConfig(level=logging.INFO)
api = Client(url, username=username, password=apiKey)

However I get a 401 Authorization required error:


  File "C:\ProgramData\Anaconda3\lib\site-packages\suds\client.py", line 677, in process_reply
    raise Exception((status, description))

Exception: (401, 'Authorization Required')

I thought I can access data even tho I’m a basic user if I’m not mistaken?
For my username, I used the username which appears in this post. For the API key I did use the API key under my name which is active (green light).
Thanks in advance!

Hello,

This is because the example you are viewing is using an older version of our API than what you are using. The example is v2 and you are using v4.

We no longer support SOAP, so even if the code was correct you would get no data. We recommend using a RESTful interface instead, which the Python example on our product page does.

https://flightaware.com/commercial/aeroapi/

Taylor Fischer -
Commercial Support

Toll Free: +1.800.713.8570
Support Line:+1.713.588.6514

Eleven Greenway Plaza, Suite 2900 - Houston, Texas - 77046
FlightAware


Learn about FlightAware Global and Premium Accounts: http://flightaware.com/commercial/