wikitree api with python

+1 vote
190 views
Can anyone help with using the wikitree api with python?
in WikiTree Tech by David Anderson G2G6 (6.8k points)
What would you like to know? Do you already have code? You may PM me if you like.
I am trying to bring wt_apps up to date
Sorry, I am not sure I understand. wt_apps is the tag on G2G, right?

Or have you already written an app? If you can share the code bit you already have it is easier to help.

Chase's answer is mostly all you need (you might have to import json as well probably). I use post with a payload, but it all depends on how you want to approach it.

1 Answer

+5 votes

I played around with it for a bit. Here's sample code for using the getAncestors API function to get 2 generations of ancestors for Ashley-1966. Note that the end of the url is cut off. The full url is: ("https://api.wikitree.com/api.php?action=getAncestors&key=Ashley-1966&depth=2"). Just vary the action, key and fields (eg depth) per the API documentation and examples, depending on what you want to do.

import requests

response = requests.get("https://api.wikitree.com/api.php?action=getAncestors&key=Ashley-1966&depth=2")
data = response.json()
by Chase Ashley G2G6 Pilot (218k points)
edited by Chase Ashley

Related questions

+3 votes
1 answer
62 views asked Apr 20 in WikiTree Tech by Stephen Ward G2G Rookie (220 points)
+18 votes
1 answer
350 views asked Jul 19, 2019 in WikiTree Tech by Jamie Nelson G2G6 Pilot (361k points)
+4 votes
2 answers
162 views asked Dec 27, 2017 in WikiTree Tech by Hans Boldt G2G1 (1.0k points)
+8 votes
2 answers
855 views asked Sep 26, 2012 in WikiTree Tech by James Davis G2G Crew (910 points)
+18 votes
1 answer
376 views asked Jul 10, 2015 in The Tree House by Chris Whitten G2G Astronaut (1.3m points)
+3 votes
0 answers
62 views asked Aug 1 in WikiTree Tech by Kay Knight G2G6 Pilot (419k points)
+2 votes
1 answer
+1 vote
1 answer

WikiTree  ~  About  ~  Help Help  ~  Search Person Search  ~  Surname:

disclaimer - terms - copyright

...