-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when testing mta.py #11
Comments
Check for obvious stuff:
Is your API KEY correct?
Are you behind a firewall (i.e. can you ping api-endpoint.mta.info)?
Try it again...it's possible the MTA API service was down at the time you
tried (not likely... but I've seen it before).
…On Fri, Dec 3, 2021 at 10:33 PM seanykasp ***@***.***> wrote:
Im running into an issue when testin ./mta.py
I am receiving the following - are able to help point me in the right
direction?
Traceback (most recent call last):
File "./mta.py", line 180, in
print(getTrainTimes("Q03N","Q03S"))
File "./mta.py", line 151, in getTrainTimes
times = gettimes(f, ourUptownStation, ourDowntownStation)
File "./mta.py", line 72, in gettimes
response = requests.get(feed, headers=headers, timeout=30)
File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in
request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in
send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in
send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600,
in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 354,
in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1285, in _send_request
self.putheader(hdr, value)
File "/usr/lib/python3.7/http/client.py", line 1217, in putheader
values[i] = one_value.encode('latin-1')
UnicodeEncodeError: 'latin-1' codec can't encode character '\ufeff' in
position 0: ordinal not in range(256)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#11>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK7LEU635PIL3CW47FZPCVTUPGDY7ANCNFSM5JLCZ6WQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hello Alan,
I am a complete noob here. How would I test ping an API endpoint with the
pi?
…On Sat, Dec 4, 2021 at 9:09 AM Alan Light ***@***.***> wrote:
Check for obvious stuff:
Is your API KEY correct?
Are you behind a firewall (i.e. can you ping api-endpoint.mta.info)?
Try it again...it's possible the MTA API service was down at the time you
tried (not likely... but I've seen it before).
On Fri, Dec 3, 2021 at 10:33 PM seanykasp ***@***.***> wrote:
> Im running into an issue when testin ./mta.py
>
> I am receiving the following - are able to help point me in the right
> direction?
>
> Traceback (most recent call last):
> File "./mta.py", line 180, in
> print(getTrainTimes("Q03N","Q03S"))
> File "./mta.py", line 151, in getTrainTimes
> times = gettimes(f, ourUptownStation, ourDowntownStation)
> File "./mta.py", line 72, in gettimes
> response = requests.get(feed, headers=headers, timeout=30)
> File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
> return request('get', url, params=params, **kwargs)
> File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in
request
> return session.request(method=method, url=url, **kwargs)
> File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in
> request
> resp = self.send(prep, **send_kwargs)
> File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in
> send
> r = adapter.send(request, **kwargs)
> File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in
> send
> timeout=timeout
> File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line
600,
> in urlopen
> chunked=chunked)
> File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line
354,
> in _make_request
> conn.request(method, url, **httplib_request_kw)
> File "/usr/lib/python3.7/http/client.py", line 1244, in request
> self._send_request(method, url, body, headers, encode_chunked)
> File "/usr/lib/python3.7/http/client.py", line 1285, in _send_request
> self.putheader(hdr, value)
> File "/usr/lib/python3.7/http/client.py", line 1217, in putheader
> values[i] = one_value.encode('latin-1')
> UnicodeEncodeError: 'latin-1' codec can't encode character '\ufeff' in
> position 0: ordinal not in range(256)
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#11>, or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AK7LEU635PIL3CW47FZPCVTUPGDY7ANCNFSM5JLCZ6WQ
>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
>
> or Android
> <
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
>.
>
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK2G2FR5AASRE53SELJ3XCLUPIOH5ANCNFSM5JLCZ6WQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Ahh.. it's pretty EZ
Just type:
ping api-endpoint.mta.info
…On Tue, Dec 7, 2021, 8:56 PM seanykasp ***@***.***> wrote:
Hello Alan,
I am a complete noob here. How would I test ping an API endpoint with the
pi?
On Sat, Dec 4, 2021 at 9:09 AM Alan Light ***@***.***> wrote:
> Check for obvious stuff:
> Is your API KEY correct?
> Are you behind a firewall (i.e. can you ping api-endpoint.mta.info)?
> Try it again...it's possible the MTA API service was down at the time you
> tried (not likely... but I've seen it before).
>
>
>
> On Fri, Dec 3, 2021 at 10:33 PM seanykasp ***@***.***> wrote:
>
> > Im running into an issue when testin ./mta.py
> >
> > I am receiving the following - are able to help point me in the right
> > direction?
> >
> > Traceback (most recent call last):
> > File "./mta.py", line 180, in
> > print(getTrainTimes("Q03N","Q03S"))
> > File "./mta.py", line 151, in getTrainTimes
> > times = gettimes(f, ourUptownStation, ourDowntownStation)
> > File "./mta.py", line 72, in gettimes
> > response = requests.get(feed, headers=headers, timeout=30)
> > File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
> > return request('get', url, params=params, **kwargs)
> > File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in
> request
> > return session.request(method=method, url=url, **kwargs)
> > File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533,
in
> > request
> > resp = self.send(prep, **send_kwargs)
> > File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646,
in
> > send
> > r = adapter.send(request, **kwargs)
> > File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449,
in
> > send
> > timeout=timeout
> > File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line
> 600,
> > in urlopen
> > chunked=chunked)
> > File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line
> 354,
> > in _make_request
> > conn.request(method, url, **httplib_request_kw)
> > File "/usr/lib/python3.7/http/client.py", line 1244, in request
> > self._send_request(method, url, body, headers, encode_chunked)
> > File "/usr/lib/python3.7/http/client.py", line 1285, in _send_request
> > self.putheader(hdr, value)
> > File "/usr/lib/python3.7/http/client.py", line 1217, in putheader
> > values[i] = one_value.encode('latin-1')
> > UnicodeEncodeError: 'latin-1' codec can't encode character '\ufeff' in
> > position 0: ordinal not in range(256)
> >
> > —
> > You are receiving this because you are subscribed to this thread.
> > Reply to this email directly, view it on GitHub
> > <#11>, or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AK7LEU635PIL3CW47FZPCVTUPGDY7ANCNFSM5JLCZ6WQ
> >
> > .
> > Triage notifications on the go with GitHub Mobile for iOS
> > <
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> >
> > or Android
> > <
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> >.
> >
> >
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
#11 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AK2G2FR5AASRE53SELJ3XCLUPIOH5ANCNFSM5JLCZ6WQ
>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
>
> or Android
> <
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
>.
>
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK7LEU77AB7PQZDESAJN3FDUP23MVANCNFSM5JLCZ6WQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I am able to ping the api endpoint.
It doesn't seem like the terminal is properly running the python script.
…On Tue, Dec 7, 2021 at 9:09 PM Alan Light ***@***.***> wrote:
Ahh.. it's pretty EZ
Just type:
ping api-endpoint.mta.info
On Tue, Dec 7, 2021, 8:56 PM seanykasp ***@***.***> wrote:
> Hello Alan,
>
> I am a complete noob here. How would I test ping an API endpoint with the
> pi?
>
> On Sat, Dec 4, 2021 at 9:09 AM Alan Light ***@***.***> wrote:
>
> > Check for obvious stuff:
> > Is your API KEY correct?
> > Are you behind a firewall (i.e. can you ping api-endpoint.mta.info)?
> > Try it again...it's possible the MTA API service was down at the time
you
> > tried (not likely... but I've seen it before).
> >
> >
> >
> > On Fri, Dec 3, 2021 at 10:33 PM seanykasp ***@***.***> wrote:
> >
> > > Im running into an issue when testin ./mta.py
> > >
> > > I am receiving the following - are able to help point me in the right
> > > direction?
> > >
> > > Traceback (most recent call last):
> > > File "./mta.py", line 180, in
> > > print(getTrainTimes("Q03N","Q03S"))
> > > File "./mta.py", line 151, in getTrainTimes
> > > times = gettimes(f, ourUptownStation, ourDowntownStation)
> > > File "./mta.py", line 72, in gettimes
> > > response = requests.get(feed, headers=headers, timeout=30)
> > > File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in
get
> > > return request('get', url, params=params, **kwargs)
> > > File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in
> > request
> > > return session.request(method=method, url=url, **kwargs)
> > > File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533,
> in
> > > request
> > > resp = self.send(prep, **send_kwargs)
> > > File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646,
> in
> > > send
> > > r = adapter.send(request, **kwargs)
> > > File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449,
> in
> > > send
> > > timeout=timeout
> > > File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line
> > 600,
> > > in urlopen
> > > chunked=chunked)
> > > File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line
> > 354,
> > > in _make_request
> > > conn.request(method, url, **httplib_request_kw)
> > > File "/usr/lib/python3.7/http/client.py", line 1244, in request
> > > self._send_request(method, url, body, headers, encode_chunked)
> > > File "/usr/lib/python3.7/http/client.py", line 1285, in _send_request
> > > self.putheader(hdr, value)
> > > File "/usr/lib/python3.7/http/client.py", line 1217, in putheader
> > > values[i] = one_value.encode('latin-1')
> > > UnicodeEncodeError: 'latin-1' codec can't encode character '\ufeff'
in
> > > position 0: ordinal not in range(256)
> > >
> > > —
> > > You are receiving this because you are subscribed to this thread.
> > > Reply to this email directly, view it on GitHub
> > > <#11>, or unsubscribe
> > > <
> >
>
https://github.com/notifications/unsubscribe-auth/AK7LEU635PIL3CW47FZPCVTUPGDY7ANCNFSM5JLCZ6WQ
> > >
> > > .
> > > Triage notifications on the go with GitHub Mobile for iOS
> > > <
> >
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> > >
> > > or Android
> > > <
> >
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> > >.
> > >
> > >
> >
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub
> > <
>
#11 (comment)
> >,
> > or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AK2G2FR5AASRE53SELJ3XCLUPIOH5ANCNFSM5JLCZ6WQ
> >
> > .
> > Triage notifications on the go with GitHub Mobile for iOS
> > <
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> >
> > or Android
> > <
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> >.
> >
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
#11 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AK7LEU77AB7PQZDESAJN3FDUP23MVANCNFSM5JLCZ6WQ
>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
>
> or Android
> <
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
>.
>
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK2G2FV5VRJ5IZJ64GF3I33UP246PANCNFSM5JLCZ6WQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Ok, looking more closely at your error output, it looks like you're getting
an error with a unicode character FEFF which is "zero-width unbreakable
space."
Double check there is nothing weird in your apikey, make sure the last
character in the apikey is the last character in the file.
…On Tue, Dec 7, 2021 at 10:18 PM seanykasp ***@***.***> wrote:
I am able to ping the api endpoint.
It doesn't seem like the terminal is properly running the python script.
On Tue, Dec 7, 2021 at 9:09 PM Alan Light ***@***.***> wrote:
> Ahh.. it's pretty EZ
>
> Just type:
> ping api-endpoint.mta.info
>
>
>
> On Tue, Dec 7, 2021, 8:56 PM seanykasp ***@***.***> wrote:
>
> > Hello Alan,
> >
> > I am a complete noob here. How would I test ping an API endpoint with
the
> > pi?
> >
> > On Sat, Dec 4, 2021 at 9:09 AM Alan Light ***@***.***> wrote:
> >
> > > Check for obvious stuff:
> > > Is your API KEY correct?
> > > Are you behind a firewall (i.e. can you ping api-endpoint.mta.info)?
> > > Try it again...it's possible the MTA API service was down at the time
> you
> > > tried (not likely... but I've seen it before).
> > >
> > >
> > >
> > > On Fri, Dec 3, 2021 at 10:33 PM seanykasp ***@***.***> wrote:
> > >
> > > > Im running into an issue when testin ./mta.py
> > > >
> > > > I am receiving the following - are able to help point me in the
right
> > > > direction?
> > > >
> > > > Traceback (most recent call last):
> > > > File "./mta.py", line 180, in
> > > > print(getTrainTimes("Q03N","Q03S"))
> > > > File "./mta.py", line 151, in getTrainTimes
> > > > times = gettimes(f, ourUptownStation, ourDowntownStation)
> > > > File "./mta.py", line 72, in gettimes
> > > > response = requests.get(feed, headers=headers, timeout=30)
> > > > File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in
> get
> > > > return request('get', url, params=params, **kwargs)
> > > > File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in
> > > request
> > > > return session.request(method=method, url=url, **kwargs)
> > > > File "/usr/lib/python3/dist-packages/requests/sessions.py", line
533,
> > in
> > > > request
> > > > resp = self.send(prep, **send_kwargs)
> > > > File "/usr/lib/python3/dist-packages/requests/sessions.py", line
646,
> > in
> > > > send
> > > > r = adapter.send(request, **kwargs)
> > > > File "/usr/lib/python3/dist-packages/requests/adapters.py", line
449,
> > in
> > > > send
> > > > timeout=timeout
> > > > File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py",
line
> > > 600,
> > > > in urlopen
> > > > chunked=chunked)
> > > > File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py",
line
> > > 354,
> > > > in _make_request
> > > > conn.request(method, url, **httplib_request_kw)
> > > > File "/usr/lib/python3.7/http/client.py", line 1244, in request
> > > > self._send_request(method, url, body, headers, encode_chunked)
> > > > File "/usr/lib/python3.7/http/client.py", line 1285, in
_send_request
> > > > self.putheader(hdr, value)
> > > > File "/usr/lib/python3.7/http/client.py", line 1217, in putheader
> > > > values[i] = one_value.encode('latin-1')
> > > > UnicodeEncodeError: 'latin-1' codec can't encode character '\ufeff'
> in
> > > > position 0: ordinal not in range(256)
> > > >
> > > > —
> > > > You are receiving this because you are subscribed to this thread.
> > > > Reply to this email directly, view it on GitHub
> > > > <#11>, or
unsubscribe
> > > > <
> > >
> >
>
https://github.com/notifications/unsubscribe-auth/AK7LEU635PIL3CW47FZPCVTUPGDY7ANCNFSM5JLCZ6WQ
> > > >
> > > > .
> > > > Triage notifications on the go with GitHub Mobile for iOS
> > > > <
> > >
> >
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> > > >
> > > > or Android
> > > > <
> > >
> >
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> > > >.
> > > >
> > > >
> > >
> > > —
> > > You are receiving this because you authored the thread.
> > > Reply to this email directly, view it on GitHub
> > > <
> >
>
#11 (comment)
> > >,
> > > or unsubscribe
> > > <
> >
>
https://github.com/notifications/unsubscribe-auth/AK2G2FR5AASRE53SELJ3XCLUPIOH5ANCNFSM5JLCZ6WQ
> > >
> > > .
> > > Triage notifications on the go with GitHub Mobile for iOS
> > > <
> >
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> > >
> > > or Android
> > > <
> >
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> > >.
> > >
> > >
> >
> > —
> > You are receiving this because you commented.
> > Reply to this email directly, view it on GitHub
> > <
>
#11 (comment)
> >,
> > or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AK7LEU77AB7PQZDESAJN3FDUP23MVANCNFSM5JLCZ6WQ
> >
> > .
> > Triage notifications on the go with GitHub Mobile for iOS
> > <
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> >
> > or Android
> > <
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> >.
> >
> >
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
#11 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AK2G2FV5VRJ5IZJ64GF3I33UP246PANCNFSM5JLCZ6WQ
>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
>
> or Android
> <
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
>.
>
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK7LEU5SA334SSUJAKKLD23UP3E7JANCNFSM5JLCZ6WQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
So, I think that was it. I couldn’t get the mta.py file to open the
apikey.txt file so I just put the apikey directly on mta.py
I’m close. I just need to adjust the sizing.
…On Tue, Dec 7, 2021 at 10:49 PM Alan Light ***@***.***> wrote:
Ok, looking more closely at your error output, it looks like you're getting
an error with a unicode character FEFF which is "zero-width unbreakable
space."
Double check there is nothing weird in your apikey, make sure the last
character in the apikey is the last character in the file.
On Tue, Dec 7, 2021 at 10:18 PM seanykasp ***@***.***> wrote:
> I am able to ping the api endpoint.
>
> It doesn't seem like the terminal is properly running the python script.
>
> On Tue, Dec 7, 2021 at 9:09 PM Alan Light ***@***.***> wrote:
>
> > Ahh.. it's pretty EZ
> >
> > Just type:
> > ping api-endpoint.mta.info
> >
> >
> >
> > On Tue, Dec 7, 2021, 8:56 PM seanykasp ***@***.***> wrote:
> >
> > > Hello Alan,
> > >
> > > I am a complete noob here. How would I test ping an API endpoint with
> the
> > > pi?
> > >
> > > On Sat, Dec 4, 2021 at 9:09 AM Alan Light ***@***.***> wrote:
> > >
> > > > Check for obvious stuff:
> > > > Is your API KEY correct?
> > > > Are you behind a firewall (i.e. can you ping api-endpoint.mta.info
)?
> > > > Try it again...it's possible the MTA API service was down at the
time
> > you
> > > > tried (not likely... but I've seen it before).
> > > >
> > > >
> > > >
> > > > On Fri, Dec 3, 2021 at 10:33 PM seanykasp ***@***.***> wrote:
> > > >
> > > > > Im running into an issue when testin ./mta.py
> > > > >
> > > > > I am receiving the following - are able to help point me in the
> right
> > > > > direction?
> > > > >
> > > > > Traceback (most recent call last):
> > > > > File "./mta.py", line 180, in
> > > > > print(getTrainTimes("Q03N","Q03S"))
> > > > > File "./mta.py", line 151, in getTrainTimes
> > > > > times = gettimes(f, ourUptownStation, ourDowntownStation)
> > > > > File "./mta.py", line 72, in gettimes
> > > > > response = requests.get(feed, headers=headers, timeout=30)
> > > > > File "/usr/lib/python3/dist-packages/requests/api.py", line 75,
in
> > get
> > > > > return request('get', url, params=params, **kwargs)
> > > > > File "/usr/lib/python3/dist-packages/requests/api.py", line 60,
in
> > > > request
> > > > > return session.request(method=method, url=url, **kwargs)
> > > > > File "/usr/lib/python3/dist-packages/requests/sessions.py", line
> 533,
> > > in
> > > > > request
> > > > > resp = self.send(prep, **send_kwargs)
> > > > > File "/usr/lib/python3/dist-packages/requests/sessions.py", line
> 646,
> > > in
> > > > > send
> > > > > r = adapter.send(request, **kwargs)
> > > > > File "/usr/lib/python3/dist-packages/requests/adapters.py", line
> 449,
> > > in
> > > > > send
> > > > > timeout=timeout
> > > > > File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py",
> line
> > > > 600,
> > > > > in urlopen
> > > > > chunked=chunked)
> > > > > File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py",
> line
> > > > 354,
> > > > > in _make_request
> > > > > conn.request(method, url, **httplib_request_kw)
> > > > > File "/usr/lib/python3.7/http/client.py", line 1244, in request
> > > > > self._send_request(method, url, body, headers, encode_chunked)
> > > > > File "/usr/lib/python3.7/http/client.py", line 1285, in
> _send_request
> > > > > self.putheader(hdr, value)
> > > > > File "/usr/lib/python3.7/http/client.py", line 1217, in putheader
> > > > > values[i] = one_value.encode('latin-1')
> > > > > UnicodeEncodeError: 'latin-1' codec can't encode character
'\ufeff'
> > in
> > > > > position 0: ordinal not in range(256)
> > > > >
> > > > > —
> > > > > You are receiving this because you are subscribed to this thread.
> > > > > Reply to this email directly, view it on GitHub
> > > > > <#11>, or
> unsubscribe
> > > > > <
> > > >
> > >
> >
>
https://github.com/notifications/unsubscribe-auth/AK7LEU635PIL3CW47FZPCVTUPGDY7ANCNFSM5JLCZ6WQ
> > > > >
> > > > > .
> > > > > Triage notifications on the go with GitHub Mobile for iOS
> > > > > <
> > > >
> > >
> >
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> > > > >
> > > > > or Android
> > > > > <
> > > >
> > >
> >
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> > > > >.
> > > > >
> > > > >
> > > >
> > > > —
> > > > You are receiving this because you authored the thread.
> > > > Reply to this email directly, view it on GitHub
> > > > <
> > >
> >
>
#11 (comment)
> > > >,
> > > > or unsubscribe
> > > > <
> > >
> >
>
https://github.com/notifications/unsubscribe-auth/AK2G2FR5AASRE53SELJ3XCLUPIOH5ANCNFSM5JLCZ6WQ
> > > >
> > > > .
> > > > Triage notifications on the go with GitHub Mobile for iOS
> > > > <
> > >
> >
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> > > >
> > > > or Android
> > > > <
> > >
> >
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> > > >.
> > > >
> > > >
> > >
> > > —
> > > You are receiving this because you commented.
> > > Reply to this email directly, view it on GitHub
> > > <
> >
>
#11 (comment)
> > >,
> > > or unsubscribe
> > > <
> >
>
https://github.com/notifications/unsubscribe-auth/AK7LEU77AB7PQZDESAJN3FDUP23MVANCNFSM5JLCZ6WQ
> > >
> > > .
> > > Triage notifications on the go with GitHub Mobile for iOS
> > > <
> >
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> > >
> > > or Android
> > > <
> >
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> > >.
> > >
> > >
> >
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub
> > <
>
#11 (comment)
> >,
> > or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AK2G2FV5VRJ5IZJ64GF3I33UP246PANCNFSM5JLCZ6WQ
> >
> > .
> > Triage notifications on the go with GitHub Mobile for iOS
> > <
>
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
> >
> > or Android
> > <
>
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
> >.
> >
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
#11 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AK7LEU5SA334SSUJAKKLD23UP3E7JANCNFSM5JLCZ6WQ
>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
>
> or Android
> <
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
>.
>
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK2G2FTDAIPCB7Q2OFEFPN3UP3IU3ANCNFSM5JLCZ6WQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Im running into an issue when testin ./mta.py
I am receiving the following - are able to help point me in the right direction?
Traceback (most recent call last):
File "./mta.py", line 180, in
print(getTrainTimes("Q03N","Q03S"))
File "./mta.py", line 151, in getTrainTimes
times = gettimes(f, ourUptownStation, ourDowntownStation)
File "./mta.py", line 72, in gettimes
response = requests.get(feed, headers=headers, timeout=30)
File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1285, in _send_request
self.putheader(hdr, value)
File "/usr/lib/python3.7/http/client.py", line 1217, in putheader
values[i] = one_value.encode('latin-1')
UnicodeEncodeError: 'latin-1' codec can't encode character '\ufeff' in position 0: ordinal not in range(256)
The text was updated successfully, but these errors were encountered: