SlideShare a Scribd company logo
1 of 4
Download to read offline
I need to get the Python script read from a text file instead of having the tag IDs be in the script
itself so you dont have to stop the script and edit the actual script itself to input a new user. Thanks
everyone and let me know if you have any more questions or if I can help in any way! can we also
try to make the arduino code read from that text file as well? That way if we wanted to add or
delete users we can just open the text file and edit and save that. Then that way both codes will be
updated with the list of users at the same time and it's much easier to edit the list of users. I think
this would improve our project a lot if we could do that
from authy.api import AuthyApiClient
from datetime import datetime, timedelta
import serial
import time
import sys
import io
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.setup(27, GPIO.OUT)
arduino = serial.Serial('/dev/ttyACM0', 9600)
#arduino_data = arduino.readline()
timeout = 9
data =[]
for i in range(50):
b = arduino.readline()
string_n = b.decode()
string = string_n.rstrip()
s = str(string)
print(s)
data.append(s)
time.sleep(0.1)
if s == " 21 F8 7C 26":
authy_api = AuthyApiClient('jtJEfq9PPAdHOALNrt8FsVescO1C6RrZ')
response = authy_api.one_touch.send_request(
593152871, #adam
"Requesting login for Encation",
seconds_to_expire=120)
if response.ok():
print(response.get_uuid())
else:
print(response.errors())
#time.sleep(8)
old_stdout = sys.stdout
sys.stdout = buffer = io.StringIO()
if response.ok():
status = authy_api.one_touch.get_approval_status(response.get_uuid())
print(status.content)
sys.stdout = old_stdout
statuscontent = buffer.getvalue()
print(statuscontent)
index = statuscontent.find("approved")
timeout_start = time.time()
test = 0
while index != 339 and time.time() < timeout_start + timeout:
print(index)
old_stdout = sys.stdout
sys.stdout = buffer = io.StringIO()
if response.ok():
status = authy_api.one_touch.get_approval_status(response.get_uuid())
print(status.content)
sys.stdout = old_stdout
statuscontent = buffer.getvalue()
#print(index)
print(statuscontent)
index = statuscontent.find("approved")
if index == 339:
break
if test == 0.15:
break
test -= 1
if index == 339:
print('yes')
GPIO.output(17, True)
GPIO.output(27, True)
time.sleep(5)
GPIO.output(17, False)
GPIO.output(27, False)
else:
print('no')
if s == " D3 99 12 2E":
authy_api = AuthyApiClient('jtJEfq9PPAdHOALNrt8FsVescO1C6RrZ')
response = authy_api.one_touch.send_request(
596467975, #rachel
"Requesting login for Encation",
seconds_to_expire=120)
if response.ok():
print(response.get_uuid())
else:
print(response.errors())
#time.sleep(8)
old_stdout = sys.stdout
sys.stdout = buffer = io.StringIO()
#sys.stdout = old_stdout
#statuscontent = buffer.getvalue()
if response.ok():
status = authy_api.one_touch.get_approval_status(response.get_uuid())
print(status.content)
sys.stdout = old_stdout
statuscontent = buffer.getvalue()
print(statuscontent)
index = statuscontent.find("approved")
timeout_start = time.time()
test = 0
while index != 339 and time.time() < timeout_start + timeout:
print(index)
old_stdout = sys.stdout
sys.stdout = buffer = io.StringIO()
if response.ok():
status = authy_api.one_touch.get_approval_status(response.get_uuid())
print(status.content)
sys.stdout = old_stdout
statuscontent = buffer.getvalue()
#print(index)
print(statuscontent)
index = statuscontent.find("approved")
if index == 339:
break
if test == 0.15:
break
test -= 1
if index == 339:
print('yes')
GPIO.output(17, True)
GPIO.output(27, True)
time.sleep(5)
GPIO.output(17, False)
GPIO.output(27, False)
else:
print('no')
I'd appreciate the help

More Related Content

Similar to I need to get the Python script read from a text file instea.pdf

PyCon 2010 SQLAlchemy tutorial
PyCon 2010 SQLAlchemy tutorialPyCon 2010 SQLAlchemy tutorial
PyCon 2010 SQLAlchemy tutorialjbellis
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverFastly
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsTimur Shemsedinov
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesOdoo
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant TrainingAidIQ
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Juan Pablo
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CSteffen Wenz
 
Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Platonov Sergey
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak PROIDEA
 
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPatrick Allaert
 
Add an interactive command line to your C++ application
Add an interactive command line to your C++ applicationAdd an interactive command line to your C++ application
Add an interactive command line to your C++ applicationDaniele Pallastrelli
 
Help Needed!UNIX Shell and History Feature This project consists.pdf
Help Needed!UNIX Shell and History Feature This project consists.pdfHelp Needed!UNIX Shell and History Feature This project consists.pdf
Help Needed!UNIX Shell and History Feature This project consists.pdfmohdjakirfb
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityBrendan Gregg
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?Andrey Karpov
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logsStefan Krawczyk
 

Similar to I need to get the Python script read from a text file instea.pdf (20)

PyCon 2010 SQLAlchemy tutorial
PyCon 2010 SQLAlchemy tutorialPyCon 2010 SQLAlchemy tutorial
PyCon 2010 SQLAlchemy tutorial
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.js
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance Issues
 
HCE tutorial
HCE tutorialHCE tutorial
HCE tutorial
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in C
 
CGI.ppt
CGI.pptCGI.ppt
CGI.ppt
 
Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.
 
Java Fundamentals
Java FundamentalsJava Fundamentals
Java Fundamentals
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
 
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
 
Backdoor coding
Backdoor codingBackdoor coding
Backdoor coding
 
Add an interactive command line to your C++ application
Add an interactive command line to your C++ applicationAdd an interactive command line to your C++ application
Add an interactive command line to your C++ application
 
Help Needed!UNIX Shell and History Feature This project consists.pdf
Help Needed!UNIX Shell and History Feature This project consists.pdfHelp Needed!UNIX Shell and History Feature This project consists.pdf
Help Needed!UNIX Shell and History Feature This project consists.pdf
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logs
 

More from abhishekcreations1

Which one of the following is correct about Skype A Skype .pdf
Which one of the following is correct about Skype A Skype .pdfWhich one of the following is correct about Skype A Skype .pdf
Which one of the following is correct about Skype A Skype .pdfabhishekcreations1
 
PepsiCo Revenues billions 2014 to 2019 Quarter 2014 201.pdf
PepsiCo Revenues  billions 2014 to 2019 Quarter 2014 201.pdfPepsiCo Revenues  billions 2014 to 2019 Quarter 2014 201.pdf
PepsiCo Revenues billions 2014 to 2019 Quarter 2014 201.pdfabhishekcreations1
 
Which of the following relational algebra expressions corres.pdf
Which of the following relational algebra expressions corres.pdfWhich of the following relational algebra expressions corres.pdf
Which of the following relational algebra expressions corres.pdfabhishekcreations1
 
The Blood In the test tube Color the White blood celis lig.pdf
The Blood In the test tube Color the White blood celis lig.pdfThe Blood In the test tube Color the White blood celis lig.pdf
The Blood In the test tube Color the White blood celis lig.pdfabhishekcreations1
 
The nurse is caring for a client with pneumonia Click on ea.pdf
The nurse is caring for a client with pneumonia Click on ea.pdfThe nurse is caring for a client with pneumonia Click on ea.pdf
The nurse is caring for a client with pneumonia Click on ea.pdfabhishekcreations1
 
SUP 3053 Managing Operational Excellence in Organization Q.pdf
SUP 3053  Managing Operational Excellence in Organization Q.pdfSUP 3053  Managing Operational Excellence in Organization Q.pdf
SUP 3053 Managing Operational Excellence in Organization Q.pdfabhishekcreations1
 
Sophie Sue Breeders tiene las siguientes retenciones volunta.pdf
Sophie Sue Breeders tiene las siguientes retenciones volunta.pdfSophie Sue Breeders tiene las siguientes retenciones volunta.pdf
Sophie Sue Breeders tiene las siguientes retenciones volunta.pdfabhishekcreations1
 
segn willoughby por qu la msica de los indgenas americ.pdf
segn willoughby por qu la msica de los indgenas americ.pdfsegn willoughby por qu la msica de los indgenas americ.pdf
segn willoughby por qu la msica de los indgenas americ.pdfabhishekcreations1
 
QUESTION 1 a What are melanosomes and why was their discove.pdf
QUESTION 1 a What are melanosomes and why was their discove.pdfQUESTION 1 a What are melanosomes and why was their discove.pdf
QUESTION 1 a What are melanosomes and why was their discove.pdfabhishekcreations1
 
Please help with this question Please help with this questi.pdf
Please help with this question Please help with this questi.pdfPlease help with this question Please help with this questi.pdf
Please help with this question Please help with this questi.pdfabhishekcreations1
 
piacet e f2lt010 b Prlt1 c P550lt2lt0.pdf
piacet e f2lt010 b Prlt1 c P550lt2lt0.pdfpiacet e f2lt010 b Prlt1 c P550lt2lt0.pdf
piacet e f2lt010 b Prlt1 c P550lt2lt0.pdfabhishekcreations1
 
On March 20 Orioles petty cash fund of 113 is replenished.pdf
On March 20 Orioles petty cash fund of 113 is replenished.pdfOn March 20 Orioles petty cash fund of 113 is replenished.pdf
On March 20 Orioles petty cash fund of 113 is replenished.pdfabhishekcreations1
 
Melissa has a bag with 8 balls numbered 1 through 8 She is .pdf
Melissa has a bag with 8 balls numbered 1 through 8 She is .pdfMelissa has a bag with 8 balls numbered 1 through 8 She is .pdf
Melissa has a bag with 8 balls numbered 1 through 8 She is .pdfabhishekcreations1
 
Hi I need an introductionbackgroundhistory to a new star.pdf
Hi I need an introductionbackgroundhistory to a new star.pdfHi I need an introductionbackgroundhistory to a new star.pdf
Hi I need an introductionbackgroundhistory to a new star.pdfabhishekcreations1
 
Luther Industries actualmente tiene 5 millones de acciones e.pdf
Luther Industries actualmente tiene 5 millones de acciones e.pdfLuther Industries actualmente tiene 5 millones de acciones e.pdf
Luther Industries actualmente tiene 5 millones de acciones e.pdfabhishekcreations1
 
Centralised and decentralised use of ICT Documents such as .pdf
Centralised and decentralised use of ICT Documents such as .pdfCentralised and decentralised use of ICT Documents such as .pdf
Centralised and decentralised use of ICT Documents such as .pdfabhishekcreations1
 
create graphic map by comparing the pairs of biochemical rea.pdf
create graphic map by comparing the pairs of biochemical rea.pdfcreate graphic map by comparing the pairs of biochemical rea.pdf
create graphic map by comparing the pairs of biochemical rea.pdfabhishekcreations1
 
Funciones de la tarea 1 Dar informacin u opinar Ofrece he.pdf
Funciones de la tarea 1 Dar informacin u opinar Ofrece he.pdfFunciones de la tarea 1 Dar informacin u opinar Ofrece he.pdf
Funciones de la tarea 1 Dar informacin u opinar Ofrece he.pdfabhishekcreations1
 
If the correlation between x and y is 75 what percent of t.pdf
If the correlation between x and y is 75 what percent of t.pdfIf the correlation between x and y is 75 what percent of t.pdf
If the correlation between x and y is 75 what percent of t.pdfabhishekcreations1
 

More from abhishekcreations1 (20)

Which one of the following is correct about Skype A Skype .pdf
Which one of the following is correct about Skype A Skype .pdfWhich one of the following is correct about Skype A Skype .pdf
Which one of the following is correct about Skype A Skype .pdf
 
PepsiCo Revenues billions 2014 to 2019 Quarter 2014 201.pdf
PepsiCo Revenues  billions 2014 to 2019 Quarter 2014 201.pdfPepsiCo Revenues  billions 2014 to 2019 Quarter 2014 201.pdf
PepsiCo Revenues billions 2014 to 2019 Quarter 2014 201.pdf
 
Which of the following relational algebra expressions corres.pdf
Which of the following relational algebra expressions corres.pdfWhich of the following relational algebra expressions corres.pdf
Which of the following relational algebra expressions corres.pdf
 
The Blood In the test tube Color the White blood celis lig.pdf
The Blood In the test tube Color the White blood celis lig.pdfThe Blood In the test tube Color the White blood celis lig.pdf
The Blood In the test tube Color the White blood celis lig.pdf
 
The nurse is caring for a client with pneumonia Click on ea.pdf
The nurse is caring for a client with pneumonia Click on ea.pdfThe nurse is caring for a client with pneumonia Click on ea.pdf
The nurse is caring for a client with pneumonia Click on ea.pdf
 
SUP 3053 Managing Operational Excellence in Organization Q.pdf
SUP 3053  Managing Operational Excellence in Organization Q.pdfSUP 3053  Managing Operational Excellence in Organization Q.pdf
SUP 3053 Managing Operational Excellence in Organization Q.pdf
 
Sophie Sue Breeders tiene las siguientes retenciones volunta.pdf
Sophie Sue Breeders tiene las siguientes retenciones volunta.pdfSophie Sue Breeders tiene las siguientes retenciones volunta.pdf
Sophie Sue Breeders tiene las siguientes retenciones volunta.pdf
 
segn willoughby por qu la msica de los indgenas americ.pdf
segn willoughby por qu la msica de los indgenas americ.pdfsegn willoughby por qu la msica de los indgenas americ.pdf
segn willoughby por qu la msica de los indgenas americ.pdf
 
QUESTION 1 a What are melanosomes and why was their discove.pdf
QUESTION 1 a What are melanosomes and why was their discove.pdfQUESTION 1 a What are melanosomes and why was their discove.pdf
QUESTION 1 a What are melanosomes and why was their discove.pdf
 
Please help with this question Please help with this questi.pdf
Please help with this question Please help with this questi.pdfPlease help with this question Please help with this questi.pdf
Please help with this question Please help with this questi.pdf
 
piacet e f2lt010 b Prlt1 c P550lt2lt0.pdf
piacet e f2lt010 b Prlt1 c P550lt2lt0.pdfpiacet e f2lt010 b Prlt1 c P550lt2lt0.pdf
piacet e f2lt010 b Prlt1 c P550lt2lt0.pdf
 
On March 20 Orioles petty cash fund of 113 is replenished.pdf
On March 20 Orioles petty cash fund of 113 is replenished.pdfOn March 20 Orioles petty cash fund of 113 is replenished.pdf
On March 20 Orioles petty cash fund of 113 is replenished.pdf
 
P056ltplt060.pdf
P056ltplt060.pdfP056ltplt060.pdf
P056ltplt060.pdf
 
Melissa has a bag with 8 balls numbered 1 through 8 She is .pdf
Melissa has a bag with 8 balls numbered 1 through 8 She is .pdfMelissa has a bag with 8 balls numbered 1 through 8 She is .pdf
Melissa has a bag with 8 balls numbered 1 through 8 She is .pdf
 
Hi I need an introductionbackgroundhistory to a new star.pdf
Hi I need an introductionbackgroundhistory to a new star.pdfHi I need an introductionbackgroundhistory to a new star.pdf
Hi I need an introductionbackgroundhistory to a new star.pdf
 
Luther Industries actualmente tiene 5 millones de acciones e.pdf
Luther Industries actualmente tiene 5 millones de acciones e.pdfLuther Industries actualmente tiene 5 millones de acciones e.pdf
Luther Industries actualmente tiene 5 millones de acciones e.pdf
 
Centralised and decentralised use of ICT Documents such as .pdf
Centralised and decentralised use of ICT Documents such as .pdfCentralised and decentralised use of ICT Documents such as .pdf
Centralised and decentralised use of ICT Documents such as .pdf
 
create graphic map by comparing the pairs of biochemical rea.pdf
create graphic map by comparing the pairs of biochemical rea.pdfcreate graphic map by comparing the pairs of biochemical rea.pdf
create graphic map by comparing the pairs of biochemical rea.pdf
 
Funciones de la tarea 1 Dar informacin u opinar Ofrece he.pdf
Funciones de la tarea 1 Dar informacin u opinar Ofrece he.pdfFunciones de la tarea 1 Dar informacin u opinar Ofrece he.pdf
Funciones de la tarea 1 Dar informacin u opinar Ofrece he.pdf
 
If the correlation between x and y is 75 what percent of t.pdf
If the correlation between x and y is 75 what percent of t.pdfIf the correlation between x and y is 75 what percent of t.pdf
If the correlation between x and y is 75 what percent of t.pdf
 

Recently uploaded

IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 

Recently uploaded (20)

IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 

I need to get the Python script read from a text file instea.pdf

  • 1. I need to get the Python script read from a text file instead of having the tag IDs be in the script itself so you dont have to stop the script and edit the actual script itself to input a new user. Thanks everyone and let me know if you have any more questions or if I can help in any way! can we also try to make the arduino code read from that text file as well? That way if we wanted to add or delete users we can just open the text file and edit and save that. Then that way both codes will be updated with the list of users at the same time and it's much easier to edit the list of users. I think this would improve our project a lot if we could do that from authy.api import AuthyApiClient from datetime import datetime, timedelta import serial import time import sys import io import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) GPIO.setup(27, GPIO.OUT) arduino = serial.Serial('/dev/ttyACM0', 9600) #arduino_data = arduino.readline() timeout = 9 data =[] for i in range(50): b = arduino.readline() string_n = b.decode() string = string_n.rstrip() s = str(string) print(s) data.append(s) time.sleep(0.1) if s == " 21 F8 7C 26": authy_api = AuthyApiClient('jtJEfq9PPAdHOALNrt8FsVescO1C6RrZ') response = authy_api.one_touch.send_request( 593152871, #adam "Requesting login for Encation", seconds_to_expire=120) if response.ok(): print(response.get_uuid()) else: print(response.errors()) #time.sleep(8) old_stdout = sys.stdout
  • 2. sys.stdout = buffer = io.StringIO() if response.ok(): status = authy_api.one_touch.get_approval_status(response.get_uuid()) print(status.content) sys.stdout = old_stdout statuscontent = buffer.getvalue() print(statuscontent) index = statuscontent.find("approved") timeout_start = time.time() test = 0 while index != 339 and time.time() < timeout_start + timeout: print(index) old_stdout = sys.stdout sys.stdout = buffer = io.StringIO() if response.ok(): status = authy_api.one_touch.get_approval_status(response.get_uuid()) print(status.content) sys.stdout = old_stdout statuscontent = buffer.getvalue() #print(index) print(statuscontent) index = statuscontent.find("approved") if index == 339: break if test == 0.15: break test -= 1 if index == 339: print('yes') GPIO.output(17, True) GPIO.output(27, True) time.sleep(5) GPIO.output(17, False) GPIO.output(27, False) else: print('no') if s == " D3 99 12 2E": authy_api = AuthyApiClient('jtJEfq9PPAdHOALNrt8FsVescO1C6RrZ') response = authy_api.one_touch.send_request( 596467975, #rachel
  • 3. "Requesting login for Encation", seconds_to_expire=120) if response.ok(): print(response.get_uuid()) else: print(response.errors()) #time.sleep(8) old_stdout = sys.stdout sys.stdout = buffer = io.StringIO() #sys.stdout = old_stdout #statuscontent = buffer.getvalue() if response.ok(): status = authy_api.one_touch.get_approval_status(response.get_uuid()) print(status.content) sys.stdout = old_stdout statuscontent = buffer.getvalue() print(statuscontent) index = statuscontent.find("approved") timeout_start = time.time() test = 0 while index != 339 and time.time() < timeout_start + timeout: print(index) old_stdout = sys.stdout sys.stdout = buffer = io.StringIO() if response.ok(): status = authy_api.one_touch.get_approval_status(response.get_uuid()) print(status.content) sys.stdout = old_stdout statuscontent = buffer.getvalue() #print(index) print(statuscontent) index = statuscontent.find("approved") if index == 339: break if test == 0.15: break test -= 1 if index == 339: print('yes')
  • 4. GPIO.output(17, True) GPIO.output(27, True) time.sleep(5) GPIO.output(17, False) GPIO.output(27, False) else: print('no') I'd appreciate the help