Set port in requests

2mac

I'm attempting to make use of cgminer's API using Python. I'm particularly interested in utilizing the requests library.

I understand how to do basic things in requests, but cgminer wants to be a little more specific. I'd like to shrink

import socket
import json

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 4028))

sock.send(json.dumps({'command': 'summary'}))

using requests instead.

How does one specify the port using that library, and how does one send such a json request and await a response to be stored in a variable?

Sylvain Leroux

Request is an HTTP library.

You can specify the port in the URL http://example.com:4028/....

But, from what I can read in a hurry here cgminer provides a RPC API (or JSON RPC?) not an HTTP interface.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

tomcat 7: automatically redirect https requests to port 8443

来自分类Dev

Macports`port select --set`的自制版本

来自分类Dev

JavaScript(Node.js):app.set('port',port); ^ TypeError:app.set不是函数

来自分类Dev

JavaScript(Node.js):app.set('port',port); ^ TypeError:app.set不是函数

来自分类常见问题

How to set timeout for http.Get() requests in Golang?

来自分类Dev

How can I override the set axios override defaults on specific requests?

来自分类Dev

app.set('port',process.env.port || 3000)typeerror对象#<object>在object上没有方法'set'。<anonymous>

来自分类Dev

requests.exceptions.SSLError:HTTPSConnectionPool(host ='api-fxpractice.oanda.com',port = 443):URL超过了最大重试次数

来自分类Dev

javascript-Express.js中的app.set('port',8080)与app.listen(8080)

来自分类Dev

mail(): 无法连接到 "localhost" 端口 25 的邮件服务器,请验证 php.ini 中的 "SMTP" 和 "smtp_port" 设置或使用 ini_set()

来自分类Dev

Is there a difference between an I/O port and a physical port?

来自分类Dev

Implementing TFS Pull Requests

来自分类Dev

Forwarding HTTP Requests in Java

来自分类Dev

从Requests Python清除cookie

来自分类Dev

Port Forwarding, and Python Sockets

来自分类Dev

Serial Port Comunication RXTX

来自分类Dev

FTP非法PORT命令

来自分类Dev

Xampp Port for Apache

来自分类Dev

Easy Port Tunneling Linux

来自分类Dev

错误:监听EADDRINUSE ::: port

来自分类Dev

什么是端口转发中的“Local Port from”、“Local Port to”、“Remote Port from”和“Remote port to”?

来自分类Dev

Limit number of requests at a time with RxJS

来自分类Dev

使用Requests Python提交表单

来自分类Dev

How to chain these two Postman requests

来自分类Dev

requests.exceptions.ConnectionError:HTTPConnectionPool

来自分类Dev

Using Cookies with Robospice Retrofit requests

来自分类Dev

为什么`requests`使用`with`语句?

来自分类Dev

python-requests和EchoSign

来自分类Dev

Delphi TIdTCPServer processing multiple requests

Related 相关文章

  1. 1

    tomcat 7: automatically redirect https requests to port 8443

  2. 2

    Macports`port select --set`的自制版本

  3. 3

    JavaScript(Node.js):app.set('port',port); ^ TypeError:app.set不是函数

  4. 4

    JavaScript(Node.js):app.set('port',port); ^ TypeError:app.set不是函数

  5. 5

    How to set timeout for http.Get() requests in Golang?

  6. 6

    How can I override the set axios override defaults on specific requests?

  7. 7

    app.set('port',process.env.port || 3000)typeerror对象#<object>在object上没有方法'set'。<anonymous>

  8. 8

    requests.exceptions.SSLError:HTTPSConnectionPool(host ='api-fxpractice.oanda.com',port = 443):URL超过了最大重试次数

  9. 9

    javascript-Express.js中的app.set('port',8080)与app.listen(8080)

  10. 10

    mail(): 无法连接到 "localhost" 端口 25 的邮件服务器,请验证 php.ini 中的 "SMTP" 和 "smtp_port" 设置或使用 ini_set()

  11. 11

    Is there a difference between an I/O port and a physical port?

  12. 12

    Implementing TFS Pull Requests

  13. 13

    Forwarding HTTP Requests in Java

  14. 14

    从Requests Python清除cookie

  15. 15

    Port Forwarding, and Python Sockets

  16. 16

    Serial Port Comunication RXTX

  17. 17

    FTP非法PORT命令

  18. 18

    Xampp Port for Apache

  19. 19

    Easy Port Tunneling Linux

  20. 20

    错误:监听EADDRINUSE ::: port

  21. 21

    什么是端口转发中的“Local Port from”、“Local Port to”、“Remote Port from”和“Remote port to”?

  22. 22

    Limit number of requests at a time with RxJS

  23. 23

    使用Requests Python提交表单

  24. 24

    How to chain these two Postman requests

  25. 25

    requests.exceptions.ConnectionError:HTTPConnectionPool

  26. 26

    Using Cookies with Robospice Retrofit requests

  27. 27

    为什么`requests`使用`with`语句?

  28. 28

    python-requests和EchoSign

  29. 29

    Delphi TIdTCPServer processing multiple requests

热门标签

归档