Tripit Export Github API code not working
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I am not a coder. Trying to use a Github repo mattbaylisFL/tripit-to-flightdiary to use Tripit's API to get out my list of flights.

Get through the auth. Get to running tripit.py. It does seem to run for a while - like it's doing something then get this error.

Traceback (most recent call last):
File "C:\Users\XXX\Documents\GitHub\tripit-to-flightdiary\tripit.py", line 19, in
main()
File "C:\Users\XXX\Documents\GitHub\tripit-to-flightdiary\tripit.py", line 16, in main
print json.dumps(get_trips(), indent=4)
File "C:\Users\XXX\Documents\GitHub\tripit-to-flightdiary\tripit.py", line 13, in get_trips
'page_size/500/include_objects/true', auth=auth).json()
File "C:\Python27\lib\site-packages\requests\models.py", line 896, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Python27\lib\json_init_.py", line 339, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

I made a tripit account, created an app and went through the process described in the README in the Github repo. However, I had to change foo to a dummy URL (http://foo.com) in order for the process to work. Then I ran tripit.py after adding a past trip in my profile and it successfully printed out a sensible response without throwing any exception. The error you're getting is likely because you're receiving an empty response, but I tried a few things and I never managed to get that.
CyteBode 11 days ago
Okay, I managed to get your error by mutating the URL. Even if part of it is wrong the site responds with a 200 status code (no error) and an XML response which the JSON module of course cannot parse. So either re-download the files from the repository or make sure that the URL is indeed 'https://api.tripit.com/v1/list/trip/' 'traveler/true/past/true/format/json/' 'page_size/500/include_objects/true' (in three lines, which Python joins automatically).
CyteBode 11 days ago
Thanks. Awesome. I want to pay you but I think you didn't do it as a solution. Can you do so?
sebmack 10 days ago
Thanks! I've posted a solution so you can accept it.
CyteBode 10 days ago
awarded to ahmedengu

Crowdsource coding tasks.

2 Solutions

Winning solution

Greetings,

I have created a fork of the repo with an updated readme and the required changes
the repo can be found here: https://github.com/ahmedengu/tripit-to-flightdiary

working

Just make sure that you are using python 2.7

and follow the instructions

i don't have any trips yet but the concept is the same

steps:

  1. download and extract the repo: https://github.com/ahmedengu/tripit-to-flightdiary/archive/master.zip
  2. install python 2.7 https://www.python.org/download/releases/2.7/
  3. run pip install -r requierements.txt
  4. update creds.json
  5. run and follow python get_token.py the creds.json gonna get updated automatically
  6. run python tripit.py ... tripit.json gonna get generated automatically containing the trips

Hope that's clear

Best Regards,

Ahmed

Hi. Awesome stuff. Haven't tested it but looks easier. Cytebode actually helped me out with my malformed URL so I will work out how to reward both once it's in. I'll also post another challenge too!
sebmack 10 days ago
Thank you
ahmedengu 10 days ago

As I found out in the comments above, it was just a malformed URL.

Thanks for the tip!
CyteBode 10 days ago
View Timeline