Forums

Pywapi

I am using Pywapi for accessing weather API.

But Pythonanywhere is unable to import Pywapi??

My code is :

import pywapi

weather_com_result = pywapi.get_weather_from_weather_com('TUXX0014')**

However it is working properly on my local Pycharm tool/

Can you please share any alternative?? :(

Pywapi isn't installed by default, but if you run this from a bash console:

pip2.7 install --user https://launchpad.net/python-weather-api/trunk/0.3.8/+download/pywapi-0.3.8.tar.gz

...then it should work. Don't forget to change the 2.7 to reflect the version of Python you want to install it for.

thank you for your response.

but i can install other softwares but failed to install pwapi with following error

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1197, in prepare_files
    do_download,
  File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1375, in unpack_url
    self.session,
  File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 546, in unpack_http_url
    resp = session.get(target_url, stream=True)
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 468, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 237, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 456, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 585, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 179, in resolve_redirects
    allow_redirects=False,
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 559, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/adapters.py", line 378, in send
    raise ProxyError(e)
ProxyError: ('Cannot connect to proxy.', error('Tunnel connection failed: 403 Forbidden',))

[edited by admin: formatting]

Ah, it looks like the launchpad.net URL redirected to a different site that wasn't on our whitelist for free users. I've added it, so it should work now.

Thanks it works :)

Excellent, thanks for confirming!