Exemplo n.º 1
0
if __name__ == '__main__':
    # The fuel type we want. 56 is premium unleaded
    FUEL_TYPE = "56"

    # The email of all of our accounts
    accounts = [
        "*****@*****.**", "*****@*****.**",
        "*****@*****.**"
    ]

    passwords = ["myfirstpassword", "thisispassword2", "andthethirdone"]

    # Combine the username and password together
    for user in zip(accounts, passwords):
        # Login to 7Eleven
        myaccount = account.login(user[0], user[1])

        # Get the cheapest fuel, and work out how much fuel we can lock in
        fuel_location = getCheapestFuel(FUEL_TYPE)
        litres = int(150)

        # Start the lock in session. Here you can confirm the price if you want
        # Note: You need to add the price confirmation yourself.
        fuellock.startLockinSession(myaccount[0], myaccount[1],
                                    fuel_location[2], fuel_location[3])

        # Lock in the price
        fuellock.confirmLockin(myaccount[0], myaccount[1], myaccount[2],
                               FUEL_TYPE, litres)

        # And for good measure, just logout again
Exemplo n.º 2
0
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program. If not, see <https://www.gnu.org/licenses/>.
'''

import api.creditcard as creditcard
import api.account as account
import api.fuellock as fuellock
import api.giftcard as giftcard
import json

if __name__ == '__main__':
    # We need to save the login details into a variable. When you login there are 3 details that 7-Eleven responds
    # with. They are your device secret token, access token and your account id.
    # Device secret and access token are used for almost every request to identify the user as you.
    myaccount = account.login("*****@*****.**", "password")

    # Get your account details. The response is a JSON array.
    get_account_details = json.loads(
        account.getAccountDetails(myaccount[0], myaccount[1]))
    # Print the users first name
    print get_account_details['PersonalDetails']['Name']['Firstname']

    account.logout(myaccount[0], myaccount[1])