Created
January 22, 2014 11:40
-
-
Save knmkr/8557304 to your computer and use it in GitHub Desktop.
Example for calling SNPedia API from python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import argparse | |
from wikitools import wiki # https://github.com/alexz-enwp/wikitools | |
from wikitools import page | |
def search_snpedia(snp): | |
""" | |
http://snpedia.com/index.php/Bulk | |
""" | |
site = wiki.Wiki("http://bots.snpedia.com/api.php") | |
pagehandle = page.Page(site,snp) | |
snp_page = pagehandle.getWikiText() | |
return snp_page | |
def _main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('snp', type=str, help='snp like `rs3`') | |
args = parser.parse_args() | |
found = search_snpedia(args.snp) | |
print found | |
if __name__ == '__main__': | |
_main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Something changed, it just gives
Invalid JSON, trying request again
errors now.