Comments (6)
@salro I cannot reproduce this error, what version of Python are you using and can you post a pip freeze
here?
@mikeckennedy I do hit another issue upon writing a post:
write_post
has this line:
print("Created new post successfully: {}".format(resp.json().get('id')))
print()
But the response json has 3 items:
(Pdb) resp.json()
[{'id': 'c7081102-e2c9-41ec-8b79-adc1f3469d91', 'published': '2017-02-14', 'view_count': 1231, 'content': "So maybe you've heard about Requests...", 'title': 'Easy Breezy Python HTTP Clients'}, {'id': '82160025-e50d-4993-aef7-dc423677ab05', 'published': '2017-02-08', 'view_count': 10, 'content': "Python's standard urllib2 module provides most of the HTTP capabilities you need, but the API is thoroughly broken. It was built for a different time - and a different web. It requires an enormous amount of work (even method overrides) to perform the simplest of tasks.\n\nThings shouldn't be this way. Not in Python.", 'title': 'Introducing Requests for Python'}, {'id': '0b52ded1-29e4-4368-a41f-5c244cb9f469', 'published': '2017-02-01', 'view_count': 100, 'content': 'Enjoy productive Python, Django, and Web development with PyCharm, an intelligent Python IDE offering unique coding experience...', 'title': 'PyCharm, the Best IDE for Python'}]
(Pdb) len(resp.json())
3
So it fails with:
print("Created new post successfully: {}".format(resp.json().get('id')))
AttributeError: 'list' object has no attribute 'get'
I can patch it but waiting for @salro's response on the other issue ...
from 100daysofcode-with-python-course.
Hi @bbelderbos .
I am working on Python 3.9 and here is the pip freeze:
certifi==2020.12.5
chardet==4.0.0
idna==3.1
requests==2.25.1
six==1.15.0
uplink==0.9.3
uritemplate==3.0.1
urllib3==1.26.2
Edit: Also tried it on Python 3.6 with the same error.
Thanks for your help.
from 100daysofcode-with-python-course.
@salro yeah with uplink==0.9.3
I am hitting the same issue. Try uplink==0.4.0
which is actually the "pinned" version in the requirements.txt file, then it should work (apart from the new issue on write which I will PR ...)
from 100daysofcode-with-python-course.
Actually I am a bit confused @mikeckennedy, is the blog_client.py
complete?
resp = svc.create_new_entry(title, content, view_count)
gives me a <Response [200]>
which basically retrieves the 3 articles:
1. [1,231 views] Easy Breezy Python HTTP Clients
2. [10 views] Introducing Requests for Python
3. [100 views] PyCharm, the Best IDE for Python
(full JSON output from pdb
pasted above)
Could you please check? Thanks
from 100daysofcode-with-python-course.
@bbelderbos I missed the correct version number for uplink. Thanks for pointing it out and I will use the correct one now.
from 100daysofcode-with-python-course.
Hi all. I believe this was a bug in 0.9.3 of uplink. We are now at 0.9.4 and it seems to work again as you would expect. Sorry for the trouble. Incoming update in 3, 2, 1, ...
from 100daysofcode-with-python-course.
Related Issues (20)
- parse error HOT 8
- urlretrieve function HOT 3
- Small detail on capturing all capitalized words HOT 1
- Possible misleading typo in 22-24 Decorators HOT 1
- video 'hello test world' HOT 10
- The subtitles for the deque and first concept videos (days 4-6) are swapped around. HOT 1
- Add section about setting things up HOT 2
- Missing README for days 04-06 HOT 3
- Days 58-60 Twitter HOT 3
- packtpub 'find_element_by_name' doesn't work HOT 1
- Pyperclip does not work correctly under Linux HOT 1
- Packt Publishing website updated HOT 4
- Python 100 days2 HOT 2
- Day 55-57 Example - write_post() HOT 3
- 100 Days of Code
- 100days HOT 1
- day 2 error HOT 3
- Link in day 5 is broken HOT 1
- Link for the pytest fixtures article (day 12) is broken HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 100daysofcode-with-python-course.