Coder Social home page Coder Social logo

Write a Requests adapter about hyper HOT 13 CLOSED

python-hyper avatar python-hyper commented on July 18, 2024
Write a Requests adapter

from hyper.

Comments (13)

Lukasa avatar Lukasa commented on July 18, 2024

By the way, @michaelhelmick, you may end up wanting to keep an eye on this issue, I plan to play with Twython a bit here.

from hyper.

michaelhelmick avatar michaelhelmick commented on July 18, 2024

👍 I'll help be a Guinea Pig :) just let me know if I can so anything. I need to get back to some open source stuff. Been keeping busy with work D:

from hyper.

Lukasa avatar Lukasa commented on July 18, 2024

So mostly this is fine, except for the fact that Twython relies on urllib3's transparent content decoding, which hyper doesn't have. Awkward.

from hyper.

Lukasa avatar Lukasa commented on July 18, 2024

Tracking that issue in #20.

from hyper.

Lukasa avatar Lukasa commented on July 18, 2024

Current draft adapter is on the requests_adapter branch. Not sure how best to test it yet.

from hyper.

sigmavirus24 avatar sigmavirus24 commented on July 18, 2024

@Lukasa with the integration test fixtures?

from hyper.

Lukasa avatar Lukasa commented on July 18, 2024

That might be the way to go.

from hyper.

Lukasa avatar Lukasa commented on July 18, 2024

Alright, the adapter got checked in as part of 799e37e. It's been enhanced a few times since as well. @michaelhelmick, if you want to start messing about with it go ahead. I've confirmed in a quick local test file that it works in the basic case, as you can see below. Note that you'll need to install hyper from GitHub, not from PyPI, as I haven't done a new release yet.

from hyper.contrib import HTTP20Adapter
from twython import Twython

API_KEY = ...
API_SECRET = ...
ACCESS_TOKEN = ..
ACCESS_SECRET = ...

t = Twython(API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_SECRET)
a = HTTP20Adapter()
t.client.mount('https://www.twitter.com', a)
t.client.mount('https://twitter.com', a)
t.client.mount('https://api.twitter.com', a)

print(t.search(q='python'))

from hyper.

Lukasa avatar Lukasa commented on July 18, 2024

You can now get the Transport Adapter in v0.0.2 from PyPI. =)

from hyper.

michaelhelmick avatar michaelhelmick commented on July 18, 2024

I replied via email, but it never sent I guess.. haha.

👌 I'm not free until Saturday to test, but I'll be sure to make time to test then!

from hyper.

michaelhelmick avatar michaelhelmick commented on July 18, 2024

Just an update, I got sick from moving our office this past week (with rain and dust and everything) and didn't feel up to testing this. I'll try to test some stuff by mid-net week! Sorry!!

from hyper.

Lukasa avatar Lukasa commented on July 18, 2024

That's not a problem at all @michaelhelmick, there's no rush here. I'm doing some basic performance analysis today anyway. =)

from hyper.

Lukasa avatar Lukasa commented on July 18, 2024

With that said, I'm getting some insane numbers that don't make any sense to me. It seems that, in HTTP/1.1, we're receiving ten times as much data as we are in HTTP/2.0. I have a question: does Twython turn off the Accept-Encoding headers in Requests?

from hyper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.