Browse Source

update README.md, simplify Bing provider implementation

master
Niklas Rosenstein 2 years ago
parent
commit
ad5f7a2525
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
  1. 6
      README.md
  2. 9
      src/wpx/providers/bing.py

6
README.md

@ -9,4 +9,10 @@ Wpx is a wallpaper downloader. That's it.
#### Usage
Get Bing's image of the day:
$ FILENAME=$(wpx bing --iotd)
Get a random image from a WallpapersHome category:
$ FILENAME=$(wpx wallpapershome --random -c '{"category": "art/anime"}')

9
src/wpx/providers/bing.py

@ -29,7 +29,6 @@ from nr.databind.json import JsonFieldName
from nr.interface import implements
from typing import Iterable, List, Tuple
from wpx.providers import IImage, IImageProvider
import contextlib
import datetime
import re
import requests
@ -65,13 +64,7 @@ class BingImage(Struct):
if response.status_code != 200:
response = requests.get(self.get_image_url(), stream=True)
response.raise_for_status()
@contextlib.contextmanager
def _return():
try:
yield response.raw
finally:
pass # TODO: Cleanup needed?
return _return()
return response.raw
class BingImageClient:

Loading…
Cancel
Save