Python config.client_id() Examples

The following are 3 code examples of config.client_id(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module config , or try the search function .
Example #1
Source File: auth.py    From line-bot-imgur-tutorial with MIT License 6 votes vote down vote up
def authenticate():
    # Get client ID and secret from config.py

    client = ImgurClient(client_id, client_secret)

    # Authorization flow, pin example (see docs for other auth types)
    authorization_url = client.get_auth_url('pin')

    print("Go to the following URL: {0}".format(authorization_url))

    # Read in the pin, handle Python 2 or 3 here.
    pin = get_input("Enter pin code: ")

    # ... redirect user to `authorization_url`, obtain pin (or code or token) ...
    credentials = client.authorize(pin, 'pin')
    client.set_user_auth(credentials['access_token'], credentials['refresh_token'])

    print("Authentication successful! Here are the details:")
    print("   Access token:  {0}".format(credentials['access_token']))
    print("   Refresh token: {0}".format(credentials['refresh_token']))

    return client


# If you want to run this as a standalone script, so be it! 
Example #2
Source File: twitchy.py    From twitchy_the_bot with MIT License 5 votes vote down vote up
def get_livestreams(self):
        print "Requesting stream info"
        for chunk in chunker(self.config.streams, 100):
            api_link = "https://api.twitch.tv/kraken/streams?channel="
            for stream in chunk:
                api_link += stream + ","
            try:
                data = requests.get(api_link, headers={'Client-ID':client_id}).json()
                if data["_total"] > 0:
                    self.parse_stream_info(data)
                else:
                    pass
            except:
                pass 
Example #3
Source File: app.py    From linode_api4-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def get_login_client():
    return LinodeLoginClient(config.client_id, config.client_secret)