Giter Site home page Giter Site logo

lds-org's Introduction

LDS-org

Most times, I can quickly jump on LDS.org and get the exact information I need. However, there are those repeated tasks I don't really want to to run time and time again. Hmm... sounds like a job for a computer.

In my current role as Clerk, reports and information are my life. I want to make it easier to get that information.

Install

For install you can use pip:

pip install lds-org

QuickStart

Using the command line, see the available endpoints and your current ID.

python -m lds-org --ask
python -m lds-org --ask -e current-user-id

Now lets get the same in python.

import lds_org

lds = lds_org.LDSOrg()
lds.signin(username, password)
rv = lds.get('current-user-id')
print(rv.json())
print(sorted(k for k, v in lds.endpoints.items()
      if isinstance(v, basestring) and v.startswith('http')))

Working endpoints

There are some endpoints, while published, don't appear to be working. Here is a list of working endpoint providing JSON. See https://tech.lds.org/wiki/LDS_Tools_Web_Services for more information.

  • current-user-detail
  • current-user-id
  • current-user-unit
  • current-user-units
  • leader-access
  • member-assignments
  • organization-list-url
  • stake-leadership
  • stake-units
  • unit-leadership
  • unit-leadership-new
  • unit-members-and-callings
  • unit-members-and-callings-v2
  • unit-membership
  • cal2x-event
  • cal2x-events

Calendar requests appear to be working but the descriptions at https://tech.lds.org/wiki/LDS_Tools_Web_Services appear to be out of date. For an example see the testing suite.

Secure your username and password

You need to keep your username and password secret. However, you also want to automate the process of getting and processing information from LDS.org. You could put your username and password in your code, but the possibility of sharing your information is very possible when you show or share your code.

This module can use environment variables containing your username and password. In *nix based systems, you can add the following to your .bashrc or its equivelent.

LDSORG_USERNAME=username; export LDSORG_USERNAME
LDSORG_PASSWORD="password"; export LDSORG_PASSWORD

Personally, I create a seperate file to fix the command line environment. I take the above and put it in a file 'ldsorg-password.txt'. From the command line, type the following and you should see your LDS.org username.

source ldsorg-password.txt
echo $LDSORG_USERNAME

Once this is done, you no longer need to either use the '--ask' parameter or specify a username/password in your code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.